Skip to content

Commit 7974a48

Browse files
f - lock order docs cleanup
1 parent 508d12f commit 7974a48

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -698,8 +698,8 @@ pub struct ChannelManager<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref,
698698
/// here are failed when we process them as pending-forwardable-HTLCs, and entries are removed
699699
/// after we generate a PaymentReceived upon receipt of all MPP parts or when they time out.
700700
///
701-
/// If any of these locks are held at the same time as `pending_inbound_payments`, the lock
702-
/// order requires that these locks are taken prior to `pending_inbound_payments`:
701+
/// If any of these locks are held at the same time, they must be acquired prior and in the
702+
/// following order:
703703
/// * `channel_state`
704704
/// * `forward_htlcs`
705705
/// * `per_peer_state`
@@ -716,8 +716,8 @@ pub struct ChannelManager<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref,
716716
///
717717
/// See `PendingOutboundPayment` documentation for more info.
718718
///
719-
/// If any of these locks are held at the same time as `pending_outbound_payments`, the lock
720-
/// order requires that these locks are taken prior to `pending_outbound_payments`:
719+
/// If any of these locks are held at the same time as, they must be acquired prior and in the
720+
/// following order:
721721
/// * `channel_state`
722722
/// * `forward_htlcs`
723723
/// * `per_peer_state`
@@ -733,7 +733,7 @@ pub struct ChannelManager<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref,
733733
/// Note that no consistency guarantees are made about the existence of a channel with the
734734
/// `short_channel_id` here, nor the `short_channel_id` in the `PendingHTLCInfo`!
735735
///
736-
/// If also holding `channel_state` lock, must lock `channel_state` prior to `forward_htlcs`.
736+
/// Locked *after* `channel_state`.
737737
#[cfg(test)]
738738
pub(super) forward_htlcs: Mutex<HashMap<u64, Vec<HTLCForwardInfo>>>,
739739
#[cfg(not(test))]
@@ -799,22 +799,22 @@ pub struct ChannelManager<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref,
799799
/// operate on the inner value freely. Sadly, this prevents parallel operation when opening a
800800
/// new channel.
801801
///
802-
/// If any of these locks are held at the same time as `per_peer_state`, the lock order
803-
/// requires that these locks are taken prior to `per_peer_state`:
802+
/// If any of these locks are held at the same time, they must be acquired prior and in the
803+
/// following order:
804804
/// * `channel_state`
805805
/// * `forward_htlcs`
806806
per_peer_state: RwLock<HashMap<PublicKey, Mutex<PeerState>>>,
807807

808-
/// If any of these locks are held at the same time as `pending_events`, the lock order
809-
/// requires that these locks are taken prior to `pending_events`:
808+
/// If any of these locks are held at the same time, they must be acquired prior and in the
809+
/// following order:
810810
/// * `channel_state`
811811
/// * `forward_htlcs`
812812
/// * `per_peer_state`
813813
/// * `pending_inbound_payments`
814814
/// * `pending_outbound_payments`
815815
pending_events: Mutex<Vec<events::Event>>,
816-
/// If any of these locks are held at the same time as `pending_background_events`, the lock
817-
/// order requires that these locks are taken prior to `pending_background_events`:
816+
/// If any of these locks are held at the same time, they must be acquired prior and in the
817+
/// following order:
818818
/// * `channel_state`
819819
/// * `forward_htlcs`
820820
/// * `per_peer_state`

0 commit comments

Comments
 (0)