Skip to content

Commit 04a2776

Browse files
Set funding_seen_onchain=true in filter_block
Marks funding_seen_onchain when we see the funding tx confirm.
1 parent b9158c5 commit 04a2776

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5332,6 +5332,19 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
53325332
L::Target: Logger,
53335333
{
53345334
let txn_matched = self.filter_block(txdata);
5335+
5336+
if !self.funding_seen_onchain {
5337+
for &(_, tx) in txdata.iter() {
5338+
let txid = tx.compute_txid();
5339+
if txid == self.funding.funding_txid() ||
5340+
self.pending_funding.iter().any(|f| f.funding_txid() == txid)
5341+
{
5342+
self.funding_seen_onchain = true;
5343+
break;
5344+
}
5345+
}
5346+
}
5347+
53355348
for tx in &txn_matched {
53365349
let mut output_val = Amount::ZERO;
53375350
for out in tx.output.iter() {
@@ -5915,7 +5928,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
59155928
/// Filters a block's `txdata` for transactions spending watched outputs or for any child
59165929
/// transactions thereof.
59175930
#[rustfmt::skip]
5918-
fn filter_block<'a>(&self, txdata: &TransactionData<'a>) -> Vec<&'a Transaction> {
5931+
fn filter_block<'a>(&mut self, txdata: &TransactionData<'a>) -> Vec<&'a Transaction> {
59195932
let mut matched_txn = new_hash_set();
59205933
txdata.iter().filter(|&&(_, tx)| {
59215934
let mut matches = self.spends_watched_output(tx);

0 commit comments

Comments
 (0)