Repository navigation
Description
Summary
A receiver can increase the total output value through replace_receiver_outputs, skip contribute_inputs, and call commit_inputs directly.
The output increase is only checked inside contribute_inputs. Neither commit_inputs nor fee calculation verifies that receiver inputs cover the increase. Fee calculation therefore returns a proposal whose absolute fee is lower than the original transaction’s fee. The sender will reject that proposal.
Reproduction test
#[test]
fn receiver_rejects_proposal_with_outputs_exceeding_inputs() {
let original_psbt = PARSED_ORIGINAL_PSBT.clone();
let original_fee = original_psbt.fee().expect("Original PSBT should have a valid fee");
let original_output = original_psbt.unsigned_tx.output[0].clone();
let original = OriginalPayload { psbt: original_psbt, params: Params::default() };
let wants_outputs =
receiver(WantsOutputs { inner: common::WantsOutputs::new(original, vec![0]) });
let replacement_output = TxOut {
value: original_output.value + original_fee + Amount::ONE_SAT,
script_pubkey: original_output.script_pubkey.clone(),
};
let persister = InMemoryPersister::default();
let wants_inputs = wants_outputs
.replace_receiver_outputs(
[replacement_output],
original_output.script_pubkey.as_script(),
)
.expect("Output replacement should succeed")
.commit_outputs()
.save(&persister)
.expect("Outputs should be committed");
let wants_fee_range =
wants_inputs.commit_inputs().save(&persister).expect("Inputs should be committed");
let result = wants_fee_range.apply_fee_range(None, None).save(&persister);
assert!(
result.is_err(),
"A proposal whose output values exceed its input values must be rejected"
);
}This test currently fails because fee calculation returns Ok.
Expected behavior
The receiver should not be able to produce a proposal when replacement outputs increase the total output value without sufficient receiver inputs. The check could occur when committing inputs or applying the fee range.
Disclosure: Written by Sol 5.6 from OpenAI.
Activity
Hardeezah commentedon Oct 8, 2026
Hey @xstoicunicornx, I wrote a test like the one in your issue and got the same result, the fee range step lets it through and the proposal ends up with a lower absolute fee than the original transaction.
I would love to take a shot at fixing it. My approach is to put the check in the fee range step so both v1 and v2 hit the same code path. If the receiver raised their own output beyond what the sender funded and has not contributed inputs to cover the difference, reject it. Output increases that are covered by contributed inputs stay allowed.
Two things I would like your take on. First, does the fee range step feel like the right place to you, or were you picturing the check somewhere earlier? Second, for a receiver output bump that is covered by a contributed input, my read is that it should pass the check and then the fee math handles it from there. Is that the behavior you expected?
(Disclosure: this comment is AI-assisted and reviewed by me.)
xstoicunicornx commentedon Oct 8, 2026
Hey @Hardeezah , thank you for your interest! Let me give this some thought and get back to you as I've got some competing priorities at the moment. If you don't hear back in a week feel free to ping me.
Hardeezah commentedon Oct 14, 2026
Hey @xstoicunicornx, pinging as you said
xstoicunicornx commentedon Oct 16, 2026
Yes I think this is probably the best place for it.
Yes I think so. From a cursory glance I think
WantsFeeRange::calculate_psbt_with_fee_rangeseems like maybe the best place? Where were you thinking?Hardeezah commentedon Oct 16, 2026
Yeah,
WantsFeeRange::calculate_psbt_with_fee_rangewas what I had in mind too, I will put a PR together for it shortly.