Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable strict multisig. #131

Closed
dajohi opened this issue May 29, 2014 · 0 comments
Closed

Enable strict multisig. #131

dajohi opened this issue May 29, 2014 · 0 comments

Comments

@dajohi
Copy link
Member

dajohi commented May 29, 2014

The reference implementation has a script verification flag SCRIPT_VERIFY_NULLDUMMY, which is used to verify the dummy stack consumed by CHECKMULTISIG is of zero-length. This flag is part of their STANDARD_SCRIPT_VERIFY_FLAGS.

See bitcoin/bitcoin@6380180

This diff should get the job done, but perhaps a flags option would be better since mempool and mining need to stay in sync.

diff --git a/mempool.go b/mempool.go
index d41f946..572a61f 100644
--- a/mempool.go
+++ b/mempool.go
@@ -905,7 +905,8 @@ func (mp *txMemPool) maybeAcceptTransaction(tx *btcutil.Tx, isOrphan *bool, isNe

        // Verify crypto signatures for each input and reject the transaction if
        // any don't verify.
-       flags := btcscript.ScriptBip16 | btcscript.ScriptCanonicalSignatures
+       flags := btcscript.ScriptBip16 | btcscript.ScriptCanonicalSignatures |
+               btcscript.ScriptStrictMultiSig
        err = btcchain.ValidateTransactionScripts(tx, txStore, flags)
        if err != nil {
                return err
diff --git a/mining.go b/mining.go
index abeb952..4bc3303 100644
--- a/mining.go
+++ b/mining.go
@@ -669,7 +669,8 @@ mempoolLoop:
                        logSkippedDeps(tx, deps)
                        continue
                }
-               flags := btcscript.ScriptBip16 | btcscript.ScriptCanonicalSignatures
+               flags := btcscript.ScriptBip16 | btcscript.ScriptCanonicalSignatures |
+                       btcscript.ScriptStrictMultiSig
                err = btcchain.ValidateTransactionScripts(tx, blockTxStore, flags)
                if err != nil {
                        minrLog.Tracef("Skipping tx %s due to error in "+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants