X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fchain%2Fchaininterface.rs;h=c6b3b1b629d0cd11051215c27c01a2f66237205d;hb=3aeec96470cc681bf6bf50baa5ce1b533762c479;hp=6f6362284072958115e97d5fe585d4e93e96e2ec;hpb=7f6c31ea15ca0042da0dd50f9e0819065eb00757;p=rust-lightning diff --git a/src/chain/chaininterface.rs b/src/chain/chaininterface.rs index 6f636228..c6b3b1b6 100644 --- a/src/chain/chaininterface.rs +++ b/src/chain/chaininterface.rs @@ -1,3 +1,7 @@ +//! Traits and utility impls which allow other parts of rust-lightning to interact with the +//! blockchain - receiving notifications of new blocks and block disconnections and allowing +//! rust-lightning to request that you monitor the chain for certain outpoints/transactions. + use bitcoin::blockdata::block::{Block, BlockHeader}; use bitcoin::blockdata::transaction::Transaction; use bitcoin::blockdata::script::Script; @@ -38,6 +42,8 @@ pub trait ChainWatchInterface: Sync + Send { /// Indicates that a listener needs to see all transactions. fn watch_all_txn(&self); + /// Register the given listener to receive events. Only a weak pointer is provided and the + /// registration should be freed once that pointer expires. fn register_listener(&self, listener: Weak); //TODO: unregister @@ -229,6 +235,7 @@ impl ChainWatchInterface for ChainWatchInterfaceUtil { } impl ChainWatchInterfaceUtil { + /// Creates a new ChainWatchInterfaceUtil for the given network pub fn new(network: Network, logger: Arc) -> ChainWatchInterfaceUtil { ChainWatchInterfaceUtil { network: network,