diff --git a/blockchain/validate.go b/blockchain/validate.go index 575861e2..89971e7f 100644 --- a/blockchain/validate.go +++ b/blockchain/validate.go @@ -11,11 +11,11 @@ import ( "math/big" "time" + "github.com/btcsuite/btcd/btcutil" "github.com/btcsuite/btcd/chaincfg" "github.com/btcsuite/btcd/chaincfg/chainhash" "github.com/btcsuite/btcd/txscript" "github.com/btcsuite/btcd/wire" - "github.com/btcsuite/btcd/btcutil" ) const ( @@ -1218,6 +1218,18 @@ func (b *BlockChain) checkConnectBlock(node *blockNode, block *btcutil.Block, vi scriptFlags |= txscript.ScriptStrictMultiSig } + // Before we execute the main scripts, we'll also check to see if + // taproot is active or not. + taprootState, err := b.deploymentState( + node.parent, chaincfg.DeploymentTaproot, + ) + if err != nil { + return err + } + if taprootState == ThresholdActive { + scriptFlags |= txscript.ScriptVerifyTaproot + } + // Now that the inexpensive checks are done and have passed, verify the // transactions are actually allowed to spend the coins by running the // expensive ECDSA signature check scripts. Doing this last helps