L::Target: Logger,
C::Target: ChainWatchInterface,
{
- fn block_connected(&self, header: &BlockHeader, height: u32, txn_matched: &[&Transaction], _indexes_of_txn_matched: &[usize]) {
- let block_hash = header.block_hash();
- {
- let mut monitors = self.monitors.lock().unwrap();
- for monitor in monitors.values_mut() {
- let txn_outputs = monitor.block_connected(txn_matched, height, &block_hash, &*self.broadcaster, &*self.fee_estimator, &*self.logger);
-
- for (ref txid, ref outputs) in txn_outputs {
- for (idx, output) in outputs.iter().enumerate() {
- self.chain_monitor.install_watch_outpoint((txid.clone(), idx as u32), &output.script_pubkey);
+ fn block_connected(&self, header: &BlockHeader, txdata: &[(usize, &Transaction)], height: u32) {
+ let mut reentered = true;
+ while reentered {
+ let matched_indexes = self.chain_monitor.filter_block(header, txdata);
+ let matched_txn: Vec<_> = matched_indexes.iter().map(|index| txdata[*index].1).collect();
+ let last_seen = self.chain_monitor.reentered();
+ let block_hash = header.block_hash();
+ {
+ let mut monitors = self.monitors.lock().unwrap();
+ for monitor in monitors.values_mut() {
+ let txn_outputs = monitor.block_connected(&matched_txn, height, &block_hash, &*self.broadcaster, &*self.fee_estimator, &*self.logger);
+
+ for (ref txid, ref outputs) in txn_outputs {
+ for (idx, output) in outputs.iter().enumerate() {
+ self.chain_monitor.install_watch_outpoint((txid.clone(), idx as u32), &output.script_pubkey);
+ }
}
}
}
+ reentered = last_seen != self.chain_monitor.reentered();
}
}