txscript: disable OP_CHECKMULTISIG and OP_CHECKMULTISIGVERIFY for tapscript

This commit is contained in:
Olaoluwa Osuntokun 2022-01-06 18:21:23 -08:00
parent c1eb15044e
commit a7a8ad7d37
No known key found for this signature in database
GPG key ID: 3BBD59E99B280306

View file

@ -2065,6 +2065,14 @@ type parsedSigInfo struct {
// Stack transformation:
// [... dummy [sig ...] numsigs [pubkey ...] numpubkeys] -> [... bool]
func opcodeCheckMultiSig(op *opcode, data []byte, vm *Engine) error {
// If we're doing tapscript execution, then this op code is disabled.
if vm.taprootCtx != nil {
str := fmt.Sprintf("OP_CHECKMULTISIG and " +
"OP_CHECKMULTISIGVERIFY are disabled during " +
"tapscript execution")
return scriptError(ErrTapscriptCheckMultisig, str)
}
numKeys, err := vm.dstack.PopInt()
if err != nil {
return err
@ -2236,7 +2244,9 @@ func opcodeCheckMultiSig(op *opcode, data []byte, vm *Engine) error {
if vm.hashCache != nil {
sigHashes = vm.hashCache
} else {
sigHashes = NewTxSigHashes(&vm.tx, vm.prevOutFetcher)
sigHashes = NewTxSigHashes(
&vm.tx, vm.prevOutFetcher,
)
}
hash, err = calcWitnessSignatureHashRaw(script, sigHashes, hashType,