]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Use the new `load_outputs_to_watch` util in `ChainMonitor` 2021-03-chanmon-deser-utils
authorMatt Corallo <git@bluematt.me>
Mon, 8 Mar 2021 05:06:31 +0000 (00:06 -0500)
committerMatt Corallo <git@bluematt.me>
Mon, 8 Mar 2021 16:45:32 +0000 (11:45 -0500)
This is slightly more effecient as it avoids a clone, but its also
nice to use our own code more.

lightning/src/chain/chainmonitor.rs

index de826d054d3716bd41df35e03706ac3e900c1322..0cf2d56a14eb5a79bb489b7fb7c27e80c7305597 100644 (file)
@@ -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);