Skip to content

Commit 4ae8fcc

Browse files
committed
Add further additional documentation to Listen
`Listen` is somewhat quiet on high-level use and even requirements, which we document further here.
1 parent 9385161 commit 4ae8fcc

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lightning/src/chain/mod.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,19 @@ impl_writeable_tlv_based!(BestBlock, {
7171
/// when needed.
7272
///
7373
/// By using [`Listen::filtered_block_connected`] this interface supports clients fetching the
74-
/// entire header chain and only blocks with matching transaction data using BIP 157 filters or
74+
/// entire block chain and only blocks with matching transaction data using BIP 157 filters or
7575
/// other similar filtering.
76+
///
77+
/// Each block must be connected in chain order with one (or more, if using the [`Filter`]
78+
/// interface and a registration occurred during the block processing) call to either
79+
/// [`Listen::block_connected`] or [`Listen::filtered_block_connected`] for each block.
80+
///
81+
/// In case of a reorg, you must call [`Listen::blocks_disconnected`] once (or more, in
82+
/// reverse-chain order) with information on the "fork point" block, i.e. the highest block which
83+
/// is in both forks.
84+
///
85+
/// Note that most implementations take a [`BestBlock`] on construction and blocks only need to be
86+
/// applied starting from that point.
7687
pub trait Listen {
7788
/// Notifies the listener that a block was added at the given height, with the transaction data
7889
/// possibly filtered.

0 commit comments

Comments
 (0)