Skip to content

Commit 2c112d7

Browse files
f - Store channels per-peer: Update per_peer_state docs
1 parent f7b51d2 commit 2c112d7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -790,8 +790,13 @@ pub struct ChannelManager<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref,
790790
///
791791
/// If we are connected to a peer we always at least have an entry here, even if no channels
792792
/// are currently open with that peer.
793-
/// Currently, we usually take an outer read lock and then operate on the inner value freely.
794-
/// Sadly, this prevents parallel per-peer operation.
793+
///
794+
/// Because adding or removing an entry is rare, we usually take an outer read lock and then
795+
/// operate on the inner value freely. This opens up for parallel per-peer operation for
796+
/// channels. Sadly, most functions that operate on the channels currently also require that
797+
/// the `channel_state` lock is aquired until more fields from the `channel_state` is moved.
798+
/// Aquiring the `channel_state` lock blocks parallel per-peer operation in the cases where it
799+
/// is needed.
795800
///
796801
/// If also holding `channel_state` lock, must lock `channel_state` prior to `per_peer_state`.
797802
#[cfg(not(any(test, feature = "_test_utils")))]

0 commit comments

Comments
 (0)