Skip to content

Commit f4139db

Browse files
jkczyzclaude
andcommitted
Document script_pubkey-only matching in into_unique_contributions
The function compares outputs by script_pubkey alone, not full TxOut, so any contribution output sharing a script with an existing output is filtered regardless of value. This is intentional — a change output's value may shift between rounds (e.g., for a new feerate) and should still match. But the consequence isn't obvious: multiple contribution outputs sharing a script are all filtered together when any existing output uses that script. Document it. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 2dec452 commit f4139db

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

lightning/src/ln/funding.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,13 @@ impl FundingContribution {
761761
(contributed_inputs, contributed_outputs.map(|output| output.script_pubkey).collect())
762762
}
763763

764+
/// Returns this contribution's inputs and outputs after removing any that overlap
765+
/// with the provided `existing_inputs`/`existing_outputs`.
766+
///
767+
/// Multiple contribution outputs sharing a `script_pubkey` are all dropped when any
768+
/// existing output uses the same script.
769+
///
770+
/// Returns `None` if every input and output was filtered as overlapping.
764771
pub(crate) fn into_unique_contributions<'a>(
765772
self, existing_inputs: impl Iterator<Item = OutPoint>,
766773
existing_outputs: impl Iterator<Item = &'a bitcoin::Script>,

0 commit comments

Comments
 (0)