diff --git a/lnwallet/script_utils.go b/lnwallet/script_utils.go index c14200df..b7c9075b 100644 --- a/lnwallet/script_utils.go +++ b/lnwallet/script_utils.go @@ -941,12 +941,22 @@ func CommitSpendNoDelay(signer Signer, signDesc *SignDescriptor, // This is just a regular p2wkh spend which looks something like: // * witness: - inputScript, err := signer.ComputeInputScript(sweepTx, signDesc) + sweepSig, err := signer.SignOutputRaw(sweepTx, signDesc) if err != nil { return nil, err } - return wire.TxWitness(inputScript.Witness), nil + // Finally, we'll manually craft the witness. The witness here is the + // exact same as a regular p2wkh witness, but we'll need to ensure that + // we use the tweaked public key as the last item in the witness stack + // which was originally used to created the pkScript we're spending. + witness := make([][]byte, 2) + witness[0] = append(sweepSig, byte(txscript.SigHashAll)) + witness[1] = TweakPubKeyWithTweak( + signDesc.PubKey, signDesc.SingleTweak, + ).SerializeCompressed() + + return witness, nil } // SingleTweakBytes computes set of bytes we call the single tweak. The purpose