From f12dfe2c452c9bba770c5835410a81dda00fc5f3 Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Mon, 6 Nov 2017 14:22:00 +0100 Subject: [PATCH] lnwallet/btcwallet: Use signDesc.HashType when signing Tis commit makes the btcwallet signer implementation use signDesc.HashType instead of SigHashAll when signing transactions. This will allow the creator of the transaction to specify the sighash policy when creating the accompanying sign descriptior. --- lnwallet/btcwallet/signer.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lnwallet/btcwallet/signer.go b/lnwallet/btcwallet/signer.go index 82cb69292..d8e01b4eb 100644 --- a/lnwallet/btcwallet/signer.go +++ b/lnwallet/btcwallet/signer.go @@ -141,7 +141,7 @@ func (b *BtcWallet) SignOutputRaw(tx *wire.MsgTx, amt := signDesc.Output.Value sig, err := txscript.RawTxInWitnessSignature(tx, signDesc.SigHashes, - signDesc.InputIndex, amt, witnessScript, txscript.SigHashAll, + signDesc.InputIndex, amt, witnessScript, signDesc.HashType, privKey) if err != nil { return nil, err @@ -227,7 +227,7 @@ func (b *BtcWallet) ComputeInputScript(tx *wire.MsgTx, // TODO(roasbeef): adhere to passed HashType witnessScript, err := txscript.WitnessSignature(tx, signDesc.SigHashes, signDesc.InputIndex, signDesc.Output.Value, witnessProgram, - txscript.SigHashAll, privKey, true) + signDesc.HashType, privKey, true) if err != nil { return nil, err }