Skip to content

Commit ecd4975

Browse files
committed
f Add references to BIP 147 + 146
1 parent fc2919b commit ecd4975

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lightning/src/ln/chan_utils.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,14 +652,16 @@ impl LocalCommitmentTransaction {
652652

653653
let htlc_redeemscript = get_htlc_redeemscript_with_explicit_keys(&this_htlc.0, &self.local_keys.a_htlc_key, &self.local_keys.b_htlc_key, &self.local_keys.revocation_key);
654654

655-
htlc_tx.input[0].witness.push(Vec::new()); // First is the multisig dummy
655+
// First push the multisig dummy, note that due to BIP147 (NULLDUMMY) it must be a zero-length element.
656+
htlc_tx.input[0].witness.push(Vec::new());
656657

657658
htlc_tx.input[0].witness.push(this_htlc.1.unwrap().serialize_der().to_vec());
658659
htlc_tx.input[0].witness.push(signature.serialize_der().to_vec());
659660
htlc_tx.input[0].witness[1].push(SigHashType::All as u8);
660661
htlc_tx.input[0].witness[2].push(SigHashType::All as u8);
661662

662663
if this_htlc.0.offered {
664+
// Due to BIP146 (MINIMALIF) this must be a zero-length element to relay.
663665
htlc_tx.input[0].witness.push(Vec::new());
664666
} else {
665667
htlc_tx.input[0].witness.push(preimage.unwrap().0.to_vec());

0 commit comments

Comments
 (0)