mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-02-24 23:08:36 +01:00
Use proper sighash flag for remote HTLCs with anchor outputs
This commit is contained in:
parent
a82fb62856
commit
2f4a1f7f79
1 changed files with 10 additions and 1 deletions
|
@ -160,7 +160,16 @@ impl BaseSign for EnforcingSigner {
|
|||
|
||||
let htlc_redeemscript = chan_utils::get_htlc_redeemscript(&this_htlc, self.opt_anchors(), &keys);
|
||||
|
||||
let sighash = hash_to_message!(&sighash::SighashCache::new(&htlc_tx).segwit_signature_hash(0, &htlc_redeemscript, this_htlc.amount_msat / 1000, EcdsaSighashType::All).unwrap()[..]);
|
||||
let sighash_type = if self.opt_anchors() {
|
||||
EcdsaSighashType::SinglePlusAnyoneCanPay
|
||||
} else {
|
||||
EcdsaSighashType::All
|
||||
};
|
||||
let sighash = hash_to_message!(
|
||||
&sighash::SighashCache::new(&htlc_tx).segwit_signature_hash(
|
||||
0, &htlc_redeemscript, this_htlc.amount_msat / 1000, sighash_type,
|
||||
).unwrap()[..]
|
||||
);
|
||||
secp_ctx.verify_ecdsa(&sighash, sig, &keys.countersignatory_htlc_key).unwrap();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue