Make fail_htlc_backwards_internal borrow parameters
[rust-lightning] / lightning-block-sync / src / init.rs
index b3f745bd26e361e670e66436abb7b1dae7310979..893f4b5d4d854c3e44ebf64922c46f338278fd9d 100644 (file)
@@ -61,16 +61,15 @@ BlockSourceResult<ValidatedBlockHeader> where B::Target: BlockSource {
 ///
 /// async fn init_sync<
 ///    B: BlockSource,
-///    K: KeysInterface<Signer = S>,
-///    S: keysinterface::Sign,
+///    K: KeysInterface,
 ///    T: BroadcasterInterface,
 ///    F: FeeEstimator,
 ///    L: Logger,
 ///    C: chain::Filter,
-///    P: chainmonitor::Persist<S>,
+///    P: chainmonitor::Persist<K::Signer>,
 /// >(
 ///    block_source: &B,
-///    chain_monitor: &ChainMonitor<S, &C, &T, &F, &L, &P>,
+///    chain_monitor: &ChainMonitor<K::Signer, &C, &T, &F, &L, &P>,
 ///    config: UserConfig,
 ///    keys_manager: &K,
 ///    tx_broadcaster: &T,
@@ -80,7 +79,7 @@ BlockSourceResult<ValidatedBlockHeader> where B::Target: BlockSource {
 /// ) {
 ///    // Read a serialized channel monitor paired with the block hash when it was persisted.
 ///    let serialized_monitor = "...";
-///    let (monitor_block_hash, mut monitor) = <(BlockHash, ChannelMonitor<S>)>::read(
+///    let (monitor_block_hash, mut monitor) = <(BlockHash, ChannelMonitor<K::Signer>)>::read(
 ///            &mut Cursor::new(&serialized_monitor), keys_manager).unwrap();
 ///
 ///    // Read the channel manager paired with the block hash when it was persisted.
@@ -95,7 +94,7 @@ BlockSourceResult<ValidatedBlockHeader> where B::Target: BlockSource {
 ///                    config,
 ///                    vec![&mut monitor],
 ///            );
-///            <(BlockHash, ChannelManager<S, &ChainMonitor<S, &C, &T, &F, &L, &P>, &T, &K, &F, &L>)>::read(
+///            <(BlockHash, ChannelManager<&ChainMonitor<K::Signer, &C, &T, &F, &L, &P>, &T, &K, &F, &L>)>::read(
 ///                    &mut Cursor::new(&serialized_manager), read_args).unwrap()
 ///    };
 ///
@@ -216,6 +215,16 @@ impl<'a, L: chain::Listen + ?Sized> chain::Listen for DynamicChainListener<'a, L
 struct ChainListenerSet<'a, L: chain::Listen + ?Sized>(Vec<(u32, &'a L)>);
 
 impl<'a, L: chain::Listen + ?Sized> chain::Listen for ChainListenerSet<'a, L> {
+       // Needed to differentiate test expectations.
+       #[cfg(test)]
+       fn block_connected(&self, block: &bitcoin::Block, height: u32) {
+               for (starting_height, chain_listener) in self.0.iter() {
+                       if height > *starting_height {
+                               chain_listener.block_connected(block, height);
+                       }
+               }
+       }
+
        fn filtered_block_connected(&self, header: &BlockHeader, txdata: &chain::transaction::TransactionData, height: u32) {
                for (starting_height, chain_listener) in self.0.iter() {
                        if height > *starting_height {