From 9054ef8354fb2359999ecfc059e9c96e8caeb0bf Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Tue, 18 Oct 2016 18:03:51 -0700 Subject: [PATCH] BIP 147: enforce NULLDUMMY w/ segwit verification MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit implements the flag activation portion of BIP 0147. The verification behavior triggered by the NULLDUMMY script verification flag has been present within btcd for some time, however it wasn’t activated by default. With this commit, once segwit has activated, the ScriptStrictMultiSig will also be activated within the Script VM. Additionally, the ScriptStrictMultiSig is now a standard script verification flag which is used unconditionally within the mempool. --- blockchain/validate.go | 2 ++ txscript/standard.go | 1 + 2 files changed, 3 insertions(+) diff --git a/blockchain/validate.go b/blockchain/validate.go index 0ad13159..7c25ff9e 100644 --- a/blockchain/validate.go +++ b/blockchain/validate.go @@ -1196,6 +1196,8 @@ func (b *BlockChain) checkConnectBlock(node *blockNode, block *btcutil.Block, vi } } + scriptFlags |= txscript.ScriptStrictMultiSig + // 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 diff --git a/txscript/standard.go b/txscript/standard.go index b8ffc42a..56116507 100644 --- a/txscript/standard.go +++ b/txscript/standard.go @@ -38,6 +38,7 @@ const ( ScriptVerifyCheckLockTimeVerify | ScriptVerifyCheckSequenceVerify | ScriptVerifyLowS | + ScriptStrictMultiSig | ScriptVerifyWitness | ScriptVerifyDiscourageUpgradeableWitnessProgram )