-
Notifications
You must be signed in to change notification settings - Fork 421
Track funding tx channelmonitor #4109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
8376197
cdc4ebf
b725130
c665c95
1f9ee40
ef38903
400730f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5818,10 +5818,17 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> { | |
|
||
/// Filters a block's `txdata` for transactions spending watched outputs or for any child | ||
/// transactions thereof. | ||
/// While iterating, this also tracks whether we observed the funding transaction. | ||
#[rustfmt::skip] | ||
fn filter_block<'a>(&self, txdata: &TransactionData<'a>) -> Vec<&'a Transaction> { | ||
fn filter_block<'a>(&mut self, txdata: &TransactionData<'a>) -> Vec<&'a Transaction> { | ||
let mut matched_txn = new_hash_set(); | ||
txdata.iter().filter(|&&(_, tx)| { | ||
let txid = tx.compute_txid(); | ||
if !self.funding_seen_onchain && (txid == self.funding.funding_txid() || | ||
self.pending_funding.iter().any(|f| f.funding_txid() == txid)) | ||
{ | ||
self.funding_seen_onchain = true; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to reset this in case of a reorg, i.e., in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. see #3838 (comment) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Ah, right, I knew I saw a related comment somewhere. Mind adding a comment (or two) in the code explaining that and why we're fine with it never being unset? FWIW, the current behavior might be okay for the current use case, but if someone would ever reuse the flag for some other application they might be surprised to find it's not unset if there's a reorg. |
||
} | ||
let mut matches = self.spends_watched_output(tx); | ||
for input in tx.input.iter() { | ||
if matches { break; } | ||
|
@@ -5830,7 +5837,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> { | |
} | ||
} | ||
if matches { | ||
matched_txn.insert(tx.compute_txid()); | ||
matched_txn.insert(txid); | ||
} | ||
matches | ||
}).map(|(_, tx)| *tx).collect() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason we're not doing this in
transactions_confirmed
instead?