From f704c58114985a93cccacf1baf8bdfcf8cbd0f0e Mon Sep 17 00:00:00 2001 From: David Hill Date: Thu, 26 Feb 2015 18:31:52 -0500 Subject: [PATCH] Use txscript.StandardVerifyFlags By using txscript.StandardVerifyFlags when creating and validating transactions, we can ensure the transactions successfully created won't be rejected due to script policy. --- createtx.go | 8 ++------ rpcserver.go | 4 +--- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/createtx.go b/createtx.go index c2d9925..e34a7c5 100644 --- a/createtx.go +++ b/createtx.go @@ -415,14 +415,10 @@ func signMsgTx(msgtx *wire.MsgTx, prevOutputs []txstore.Credit, store *keystore. } func validateMsgTx(msgtx *wire.MsgTx, prevOutputs []txstore.Credit) error { - flags := txscript.ScriptVerifyDERSignatures | txscript.ScriptStrictMultiSig - bip16 := time.Now().After(txscript.Bip16Activation) - if bip16 { - flags |= txscript.ScriptBip16 - } for i, txin := range msgtx.TxIn { engine, err := txscript.NewScript( - txin.SignatureScript, prevOutputs[i].TxOut().PkScript, i, msgtx, flags) + txin.SignatureScript, prevOutputs[i].TxOut().PkScript, + i, msgtx, txscript.StandardVerifyFlags) if err != nil { return fmt.Errorf("cannot create script engine: %s", err) } diff --git a/rpcserver.go b/rpcserver.go index 66f9360..e1952c9 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -2841,10 +2841,8 @@ func SignRawTransaction(w *Wallet, chainSvr *chain.Client, icmd btcjson.Cmd) (in // Either it was already signed or we just signed it. // Find out if it is completely satisfied or still needs more. - flags := txscript.ScriptBip16 | txscript.ScriptVerifyDERSignatures | - txscript.ScriptStrictMultiSig engine, err := txscript.NewScript(txIn.SignatureScript, input, - i, msgTx, flags) + i, msgTx, txscript.StandardVerifyFlags) if err != nil || engine.Execute() != nil { complete = false }