Skip to content

Commit aae7b4e

Browse files
f - Update lock order tree docs again
1 parent b5bee2f commit aae7b4e

File tree

1 file changed

+27
-19
lines changed

1 file changed

+27
-19
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -670,27 +670,33 @@ pub type SimpleRefChannelManager<'a, 'b, 'c, 'd, 'e, M, T, F, L> = ChannelManage
670670
//
671671
// Lock order:
672672
// The tree structure below illustrates the lock order requirements for the different locks of the
673-
// `ChannelManager`. If two or more locks on the same branch is held at the same time, locks should
674-
// be taken in the order of the lowest to highest level in the tree.
673+
// `ChannelManager`. If two or more locks on the same branch are held at the same time, locks
674+
// should be taken in the order of the lowest to the highest level in the tree.
675675
//
676676
// Lock order tree:
677-
// │
678-
// │──`channel_state`
679-
// │ │
680-
// │ │──`id_to_peer`
681-
// │ │
682-
// │ └──`per_peer_state`
683-
// │ │
684-
// │ │──`best_block`
685-
// │ │
686-
// │ └──`pending_inbound_payments`
687-
// │ │
688-
// │ └──`pending_outbound_payments`
689-
// │ │
690-
// │ └──`pending_events`
691-
// │ │
692-
// │ └──`pending_background_events`
693-
// │
677+
//
678+
// `total_consistency_lock`
679+
// │
680+
// │──`forward_htlcs`
681+
// │
682+
// │──`channel_state`
683+
// │ │
684+
// │ │──`id_to_peer`
685+
// │ │
686+
// │ └──`per_peer_state`
687+
// │ │
688+
// │ │──`outbound_scid_aliases`
689+
// │ │
690+
// │ └──`pending_inbound_payments`
691+
// │ │
692+
// │ └──`pending_outbound_payments`
693+
// │ │
694+
// │ │──`best_block`
695+
// │ │
696+
// │ └──`pending_events`
697+
// │ │
698+
// │ └──`pending_background_events`
699+
//
694700
pub struct ChannelManager<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref>
695701
where M::Target: chain::Watch<Signer>,
696702
T::Target: BroadcasterInterface,
@@ -758,6 +764,8 @@ pub struct ChannelManager<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref,
758764
/// and some closed channels which reached a usable state prior to being closed. This is used
759765
/// only to avoid duplicates, and is not persisted explicitly to disk, but rebuilt from the
760766
/// active channel list on load.
767+
///
768+
/// See `ChannelManager` struct-level documentation for lock order requirements.
761769
outbound_scid_aliases: Mutex<HashSet<u64>>,
762770

763771
/// `channel_id` -> `counterparty_node_id`.

0 commit comments

Comments
 (0)