Merge pull request #571 from ariard/2020-04-fix-minimalif
authorMatt Corallo <649246+TheBlueMatt@users.noreply.github.com>
Fri, 3 Apr 2020 16:15:27 +0000 (16:15 +0000)
committerGitHub <noreply@github.com>
Fri, 3 Apr 2020 16:15:27 +0000 (16:15 +0000)
Enforce MINIMALIF-compliant witnesses

lightning/src/chain/keysinterface.rs
lightning/src/ln/functional_tests.rs
lightning/src/ln/onchaintx.rs

index d023c31de239c1127cf62c63ed1fabc39a6010da..2b90188637c1535bb8ce442a1f5478c914926fcf 100644 (file)
@@ -54,7 +54,7 @@ pub enum SpendableOutputDescriptor {
        /// The private key which should be used to sign the transaction is provided, as well as the
        /// full witness redeemScript which is hashed in the output script_pubkey.
        /// The witness in the spending input should be:
-       /// <BIP 143 signature generated with the given key> <one zero byte aka OP_0>
+       /// <BIP 143 signature generated with the given key> <empty vector> (MINIMALIF standard rule)
        /// <witness_script as provided>
        /// Note that the nSequence field in the input must be set to_self_delay (which corresponds to
        /// the transaction not being broadcastable until at least to_self_delay blocks after the input
index eb1194c0112adcbea3a158f59e8d6c9bf5273cc0..e6b9939efd9f0557fd6bb04318c603b26afe18f2 100644 (file)
@@ -4079,7 +4079,7 @@ macro_rules! check_spendable_outputs {
                                                                        let local_delaysig = secp_ctx.sign(&sighash, key);
                                                                        spend_tx.input[0].witness.push(local_delaysig.serialize_der().to_vec());
                                                                        spend_tx.input[0].witness[0].push(SigHashType::All as u8);
-                                                                       spend_tx.input[0].witness.push(vec!(0));
+                                                                       spend_tx.input[0].witness.push(vec!());
                                                                        spend_tx.input[0].witness.push(witness_script.clone().into_bytes());
                                                                        txn.push(spend_tx);
                                                                },
index 02dc2ebc50b69644db51374219def8137151d3ec..40d9f18abb71efc445acb26218a6c4e89a3cc99b 100644 (file)
@@ -470,7 +470,7 @@ impl<ChanSigner: ChannelKeys> OnchainTxHandler<ChanSigner> {
                                        if let &Some(preimage) = preimage {
                                                bumped_tx.input[i].witness.push(preimage.clone().0.to_vec());
                                        } else {
-                                               bumped_tx.input[i].witness.push(vec![0]);
+                                               bumped_tx.input[i].witness.push(vec![]);
                                        }
                                        bumped_tx.input[i].witness.push(witness_script.clone().into_bytes());
                                        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);