You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix build errors
Create script using p2wsh for comparison
Using p2wpkh for generating the payment script
spendable_outputs sanity check
Return err in spendable_outputs
Copy file name to clipboardExpand all lines: lightning/src/chain/keysinterface.rs
+10Lines changed: 10 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -540,6 +540,9 @@ impl InMemorySigner {
540
540
let witness_script = bitcoin::Address::p2pkh(&::bitcoin::PublicKey{compressed:true,key: remotepubkey},Network::Testnet).script_pubkey();
541
541
let sighash = hash_to_message!(&bip143::SigHashCache::new(spend_tx).signature_hash(input_idx,&witness_script, descriptor.output.value,SigHashType::All)[..]);
542
542
let remotesig = secp_ctx.sign(&sighash,&self.payment_key);
543
+
let payment_script = bitcoin::Address::p2wpkh(&::bitcoin::PublicKey{compressed:true,key: remotepubkey},Network::Bitcoin).unwrap().script_pubkey();
544
+
545
+
if payment_script != descriptor.output.script_pubkey{returnErr(());}
543
546
544
547
letmut witness = Vec::with_capacity(2);
545
548
witness.push(remotesig.serialize_der().to_vec());
@@ -570,6 +573,9 @@ impl InMemorySigner {
570
573
let witness_script = chan_utils::get_revokeable_redeemscript(&descriptor.revocation_pubkey, descriptor.to_self_delay,&delayed_payment_pubkey);
571
574
let sighash = hash_to_message!(&bip143::SigHashCache::new(spend_tx).signature_hash(input_idx,&witness_script, descriptor.output.value,SigHashType::All)[..]);
572
575
let local_delayedsig = secp_ctx.sign(&sighash,&delayed_payment_key);
576
+
let payment_script = bitcoin::Address::p2wsh(&witness_script,Network::Bitcoin).script_pubkey();
577
+
578
+
if descriptor.output.script_pubkey != payment_script {returnErr(());}
0 commit comments