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
Doc updates in keysinterface
// TODO: We really should be taking the SigHashCache as a parameter here instead of
532
533
// spend_tx, but ideally the SigHashCache would expose the transaction's inputs read-only
@@ -540,6 +541,9 @@ impl InMemorySigner {
540
541
let witness_script = bitcoin::Address::p2pkh(&::bitcoin::PublicKey{compressed:true,key: remotepubkey},Network::Testnet).script_pubkey();
541
542
let sighash = hash_to_message!(&bip143::SigHashCache::new(spend_tx).signature_hash(input_idx,&witness_script, descriptor.output.value,SigHashType::All)[..]);
542
543
let remotesig = secp_ctx.sign(&sighash,&self.payment_key);
544
+
let payment_script = bitcoin::Address::p2wpkh(&::bitcoin::PublicKey{compressed:true,key: remotepubkey},Network::Bitcoin).unwrap().script_pubkey();
545
+
546
+
if payment_script != descriptor.output.script_pubkey{returnErr(());}
543
547
544
548
letmut witness = Vec::with_capacity(2);
545
549
witness.push(remotesig.serialize_der().to_vec());
@@ -552,8 +556,9 @@ impl InMemorySigner {
552
556
/// described by descriptor, returning the witness stack for the input.
553
557
///
554
558
/// Returns an Err if the input at input_idx does not exist, has a non-empty script_sig,
555
-
/// is not spending the outpoint described by `descriptor.outpoint`, or does not have a
556
-
/// sequence set to `descriptor.to_self_delay`.
559
+
/// is not spending the outpoint described by `descriptor.outpoint`, does not have a
560
+
/// sequence set to `descriptor.to_self_delay`, or if an output descriptor
561
+
/// script_pubkey does not match the one we can spend.
// TODO: We really should be taking the SigHashCache as a parameter here instead of
559
564
// spend_tx, but ideally the SigHashCache would expose the transaction's inputs read-only
@@ -570,6 +575,9 @@ impl InMemorySigner {
570
575
let witness_script = chan_utils::get_revokeable_redeemscript(&descriptor.revocation_pubkey, descriptor.to_self_delay,&delayed_payment_pubkey);
571
576
let sighash = hash_to_message!(&bip143::SigHashCache::new(spend_tx).signature_hash(input_idx,&witness_script, descriptor.output.value,SigHashType::All)[..]);
572
577
let local_delayedsig = secp_ctx.sign(&sighash,&delayed_payment_key);
578
+
let payment_script = bitcoin::Address::p2wsh(&witness_script,Network::Bitcoin).script_pubkey();
579
+
580
+
if descriptor.output.script_pubkey != payment_script {returnErr(());}
0 commit comments