mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-22 22:25:24 +01:00
lnwallet: ensure that SignOutputRaw can sign w/ non-default sighash for schnorr sigs
Before this commitment, we'd end up failing in `schnorr.ParseSignature` if a non-default sighash was used. To fix that, we'll slice the signature to only pass in the sig w/o the sighash flag.
This commit is contained in:
parent
9b422acffe
commit
843c62b59d
1 changed files with 11 additions and 1 deletions
|
@ -401,9 +401,19 @@ func (b *BtcWallet) SignOutputRaw(tx *wire.MsgTx,
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
default:
|
||||
return nil, fmt.Errorf("unknown sign method: %v",
|
||||
signDesc.SignMethod)
|
||||
}
|
||||
|
||||
sig, err := schnorr.ParseSignature(rawSig)
|
||||
// The signature returned above might have a sighash flag
|
||||
// attached if a non-default type was used. We'll slice this
|
||||
// off if it exists to ensure we can properly parse the raw
|
||||
// signature.
|
||||
sig, err := schnorr.ParseSignature(
|
||||
rawSig[:schnorr.SignatureSize],
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue