Skip to content

Commit a4e4056

Browse files
authored
Merge pull request #571 from ariard/2020-04-fix-minimalif
Enforce MINIMALIF-compliant witnesses
2 parents f0b037c + 1508253 commit a4e4056

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

lightning/src/chain/keysinterface.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pub enum SpendableOutputDescriptor {
5454
/// The private key which should be used to sign the transaction is provided, as well as the
5555
/// full witness redeemScript which is hashed in the output script_pubkey.
5656
/// The witness in the spending input should be:
57-
/// <BIP 143 signature generated with the given key> <one zero byte aka OP_0>
57+
/// <BIP 143 signature generated with the given key> <empty vector> (MINIMALIF standard rule)
5858
/// <witness_script as provided>
5959
/// Note that the nSequence field in the input must be set to_self_delay (which corresponds to
6060
/// the transaction not being broadcastable until at least to_self_delay blocks after the input

lightning/src/ln/functional_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4079,7 +4079,7 @@ macro_rules! check_spendable_outputs {
40794079
let local_delaysig = secp_ctx.sign(&sighash, key);
40804080
spend_tx.input[0].witness.push(local_delaysig.serialize_der().to_vec());
40814081
spend_tx.input[0].witness[0].push(SigHashType::All as u8);
4082-
spend_tx.input[0].witness.push(vec!(0));
4082+
spend_tx.input[0].witness.push(vec!());
40834083
spend_tx.input[0].witness.push(witness_script.clone().into_bytes());
40844084
txn.push(spend_tx);
40854085
},

lightning/src/ln/onchaintx.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ impl<ChanSigner: ChannelKeys> OnchainTxHandler<ChanSigner> {
470470
if let &Some(preimage) = preimage {
471471
bumped_tx.input[i].witness.push(preimage.clone().0.to_vec());
472472
} else {
473-
bumped_tx.input[i].witness.push(vec![0]);
473+
bumped_tx.input[i].witness.push(vec![]);
474474
}
475475
bumped_tx.input[i].witness.push(witness_script.clone().into_bytes());
476476
log_trace!(self, "Going to broadcast Claim Transaction {} claiming remote {} htlc output {} from {} with new feerate {}...", bumped_tx.txid(), if preimage.is_some() { "offered" } else { "received" }, outp.vout, outp.txid, new_feerate);

0 commit comments

Comments
 (0)