Skip to content

Commit e770183

Browse files
committed
adding txid to filter and logging best_block_update
1 parent 20f287f commit e770183

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

lightning/src/chain/chainmonitor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ where C::Target: chain::Filter,
739739
},
740740
}
741741
if let Some(ref chain_source) = self.chain_source {
742-
monitor.load_outputs_to_watch(chain_source);
742+
monitor.load_outputs_to_watch(chain_source , &self.logger);
743743
}
744744
entry.insert(MonitorHolder {
745745
monitor,

lightning/src/chain/channelmonitor.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1343,7 +1343,15 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitor<Signer> {
13431343
/// Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
13441344
/// calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
13451345
/// have been registered.
1346-
pub fn load_outputs_to_watch<F: Deref>(&self, filter: &F) where F::Target: chain::Filter {
1346+
pub fn load_outputs_to_watch<F: Deref , L: Deref>(
1347+
&self,
1348+
filter: &F,
1349+
logger: &L,
1350+
)
1351+
where
1352+
F::Target: chain::Filter,
1353+
L::Target: Logger,
1354+
{
13471355
let lock = self.inner.lock().unwrap();
13481356
filter.register_tx(&lock.get_funding_txo().0.txid, &lock.get_funding_txo().1);
13491357
for (txid, outputs) in lock.get_outputs_to_watch().iter() {
@@ -1354,6 +1362,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitor<Signer> {
13541362
outpoint: OutPoint { txid: *txid, index: *index as u16 },
13551363
script_pubkey: script_pubkey.clone(),
13561364
});
1365+
log_trace!(logger, "Adding txid {} to the filter", txid);
13571366
}
13581367
}
13591368
}
@@ -3392,9 +3401,11 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
33923401

33933402
if height > self.best_block.height() {
33943403
self.best_block = BestBlock::new(block_hash, height);
3404+
log_trace!(logger, "New best_block of height {} has been found and updated", height);
33953405
self.block_confirmed(height, block_hash, vec![], vec![], vec![], &broadcaster, &fee_estimator, &logger)
33963406
} else if block_hash != self.best_block.block_hash() {
33973407
self.best_block = BestBlock::new(block_hash, height);
3408+
log_trace!(logger, "New best_block of block hash {} has been found and updated", block_hash);
33983409
self.onchain_events_awaiting_threshold_conf.retain(|ref entry| entry.height <= height);
33993410
self.onchain_tx_handler.block_disconnected(height + 1, broadcaster, fee_estimator, logger);
34003411
Vec::new()
@@ -3431,6 +3442,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
34313442
let mut claimable_outpoints = Vec::new();
34323443
'tx_iter: for tx in &txn_matched {
34333444
let txid = tx.txid();
3445+
log_trace!(logger, "Transaction id {} confirmed in block {}", txid , block_hash);
34343446
// If a transaction has already been confirmed, ensure we don't bother processing it duplicatively.
34353447
if Some(txid) == self.funding_spend_confirmed {
34363448
log_debug!(logger, "Skipping redundant processing of funding-spend tx {} as it was previously confirmed", txid);

0 commit comments

Comments
 (0)