Jun 21, 2022, 6 PM UTC, #review-club on LDK Slack.
lightningdevkit/rust-lightning#1507
Host: ariard PR author: ViktorTigerstrom
The PR branch HEAD was ae665ce at the time of this review club meeting.
- The core component of LDK is the
ChannelManager
. This structure gathers the channels states and the pending messages (forward HTLCs, outbound payments, inbound payments) to be applied triggering a state transition. - Beyond,
ChannelManager
holds on-chain data (e.g best block seen) and user setting (node config) as those fields alter the processing of the state transitions (e.g rejectOpenChannel
becausefunding_satoshis
is under user'smin_funding_satoshis
). - Zooming, 2 notable members of
ChannelManager
arechannel_state
andper_peer_state
.ChannelHodler
stores currently few different elements such as the channels, the HTLC to be forwarded and the LDK internal processing events.PeerState
only stores the per-peer features flag for now. - As of today,
ChannelHolder
is protected by a singleMutex
requiring in-order processing of the events, and thus only one channel can execute state transition at the same time. #1507 and the split-off #1542 are WIP enabling better parallelization of LDK channel processing.
- What's the current processing flow from receiving an inbound message in
handle_message()
to sending to the appropriateChannel
's method ? How many locks are taken and when ? - This PR is moving the
HashMap<[u8; 32], Channel<Signer>>
fromChannelHolder
toPeerState
. What's the purpose of this move ? Does it change anything for a LDK user ? - Why introducing a new
id_to_peer
inChannelManager
? - What is backward compatibility and what is LDK's project policy on structure serialization backward compatibility ?
- The PR is using
FairRwLock
to protectPeerState
. What are the advantages ofFairRwLock
compare to Rust's traditionalRwLock
. - What could be the future internal refactoring after this PR to achieve #422 ?
- Apart of HTLC/message processing, what are the other perfomance bottlenecks of a LN node ?
Thanks for this! Really looking forward to it.
Had giggle at the
ChannelHodler
typo :D