From: Matt Corallo Date: Mon, 8 Mar 2021 05:06:31 +0000 (-0500) Subject: Use the new `load_outputs_to_watch` util in `ChainMonitor` X-Git-Tag: v0.0.13~4^2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=f52f777c97887deba2814e9e9d9f82cd629b5cc4;p=rust-lightning Use the new `load_outputs_to_watch` util in `ChainMonitor` This is slightly more effecient as it avoids a clone, but its also nice to use our own code more. --- diff --git a/lightning/src/chain/chainmonitor.rs b/lightning/src/chain/chainmonitor.rs index de826d054..0cf2d56a1 100644 --- a/lightning/src/chain/chainmonitor.rs +++ b/lightning/src/chain/chainmonitor.rs @@ -193,12 +193,7 @@ where C::Target: chain::Filter, log_trace!(self.logger, "Got new Channel Monitor for channel {}", log_bytes!(funding_txo.0.to_channel_id()[..])); if let Some(ref chain_source) = self.chain_source { - chain_source.register_tx(&funding_txo.0.txid, &funding_txo.1); - for (txid, outputs) in monitor.get_outputs_to_watch().iter() { - for (idx, script_pubkey) in outputs.iter() { - chain_source.register_output(&OutPoint { txid: *txid, index: *idx as u16 }, script_pubkey); - } - } + monitor.load_outputs_to_watch(chain_source); } } entry.insert(monitor);