mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-02-25 15:20:24 +01:00
Clarify rescan rules for block_connected somewhat
This commit is contained in:
parent
bae2338b4d
commit
ca4c970467
1 changed files with 9 additions and 7 deletions
|
@ -72,11 +72,16 @@ pub trait BroadcasterInterface: Sync + Send {
|
||||||
/// A trait indicating a desire to listen for events from the chain
|
/// A trait indicating a desire to listen for events from the chain
|
||||||
pub trait ChainListener: Sync + Send {
|
pub trait ChainListener: Sync + Send {
|
||||||
/// Notifies a listener that a block was connected.
|
/// Notifies a listener that a block was connected.
|
||||||
/// Note that if a new transaction/outpoint is watched during a block_connected call, the block
|
|
||||||
/// *must* be re-scanned with the new transaction/outpoints and block_connected should be
|
|
||||||
/// called again with the same header and (at least) the new transactions.
|
|
||||||
///
|
///
|
||||||
/// Note that if non-new transaction/outpoints may be registered during a call, a second call
|
/// The txn_matched array should be set to references to transactions which matched the
|
||||||
|
/// relevant installed watch outpoints/txn, or the full set of transactions in the block.
|
||||||
|
///
|
||||||
|
/// Note that if txn_matched includes only matched transactions, and a new
|
||||||
|
/// transaction/outpoint is watched during a block_connected call, the block *must* be
|
||||||
|
/// re-scanned with the new transaction/outpoints and block_connected should be called
|
||||||
|
/// again with the same header and (at least) the new transactions.
|
||||||
|
///
|
||||||
|
/// Note that if non-new transaction/outpoints are be registered during a call, a second call
|
||||||
/// *must not* happen.
|
/// *must not* happen.
|
||||||
///
|
///
|
||||||
/// This also means those counting confirmations using block_connected callbacks should watch
|
/// This also means those counting confirmations using block_connected callbacks should watch
|
||||||
|
@ -281,7 +286,6 @@ impl<'a, CL: Deref<Target = ChainListener + 'a> + 'a> BlockNotifier<'a, CL> {
|
||||||
return last_seen != self.chain_monitor.reentered();
|
return last_seen != self.chain_monitor.reentered();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Notify listeners that a block was disconnected.
|
/// Notify listeners that a block was disconnected.
|
||||||
pub fn block_disconnected(&self, header: &BlockHeader, disconnected_height: u32) {
|
pub fn block_disconnected(&self, header: &BlockHeader, disconnected_height: u32) {
|
||||||
let listeners = self.listeners.lock().unwrap();
|
let listeners = self.listeners.lock().unwrap();
|
||||||
|
@ -289,7 +293,6 @@ impl<'a, CL: Deref<Target = ChainListener + 'a> + 'a> BlockNotifier<'a, CL> {
|
||||||
listener.block_disconnected(&header, disconnected_height);
|
listener.block_disconnected(&header, disconnected_height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Utility to capture some common parts of ChainWatchInterface implementors.
|
/// Utility to capture some common parts of ChainWatchInterface implementors.
|
||||||
|
@ -363,7 +366,6 @@ impl ChainWatchInterfaceUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Checks if a given transaction matches the current filter.
|
/// Checks if a given transaction matches the current filter.
|
||||||
pub fn does_match_tx(&self, tx: &Transaction) -> bool {
|
pub fn does_match_tx(&self, tx: &Transaction) -> bool {
|
||||||
let watched = self.watched.lock().unwrap();
|
let watched = self.watched.lock().unwrap();
|
||||||
|
|
Loading…
Add table
Reference in a new issue