diff options
author | Gavin Andresen <gavinandresen@gmail.com> | 2012-02-07 09:04:56 -0500 |
---|---|---|
committer | Gavin Andresen <gavinandresen@gmail.com> | 2012-02-07 09:04:56 -0500 |
commit | 0b452dff5e9f1401343b6c52ef739014d81fa8c6 (patch) | |
tree | e707c5982ee5f2a0a99b7e563c69d58414222eb7 /src/main.cpp | |
parent | 7bf8b7c25c944110dbe85ef9e4eebd858da34158 (diff) | |
parent | 39f0d9686095bce469dbfa52333331a5d15c6545 (diff) |
Merge branch 'standardScriptSigs' of github.com:gavinandresen/bitcoin-git
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/src/main.cpp b/src/main.cpp index 9e5f743b69..52812187d4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -295,18 +295,33 @@ bool CTransaction::AreInputsStandard(const MapPrevTx& mapInputs) const const CScript& prevScript = prev.scriptPubKey; if (!Solver(prevScript, whichType, vSolutions)) return false; + int nArgsExpected = ScriptSigArgsExpected(whichType, vSolutions); + + // Transactions with extra stuff in their scriptSigs are + // non-standard. Note that this EvalScript() call will + // be quick, because if there are any operations + // beside "push data" in the scriptSig the + // IsStandard() call returns false + vector<vector<unsigned char> > stack; + if (!EvalScript(stack, vin[i].scriptSig, *this, i, 0)) + return false; + if (whichType == TX_SCRIPTHASH) { - vector<vector<unsigned char> > stack; - - if (!EvalScript(stack, vin[i].scriptSig, *this, i, 0)) - return false; if (stack.empty()) return false; CScript subscript(stack.back().begin(), stack.back().end()); - if (!::IsStandard(subscript)) + vector<vector<unsigned char> > vSolutions2; + txnouttype whichType2; + if (!Solver(subscript, whichType2, vSolutions2)) return false; + if (whichType2 == TX_SCRIPTHASH) + return false; + nArgsExpected += ScriptSigArgsExpected(whichType2, vSolutions2); } + + if (stack.size() != nArgsExpected) + return false; } return true; |