guard cryptoconditions

This commit is contained in:
Scott Sadler
2018-02-18 20:38:29 -03:00
parent 28b946127b
commit 6263d40239
2 changed files with 12 additions and 6 deletions

View File

@@ -940,7 +940,9 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, un
case OP_CHECKCRYPTOCONDITION:
case OP_CHECKCRYPTOCONDITIONVERIFY:
{
// (fulfillment condition -- bool)
if (!IsCryptoConditionsEnabled()) {
goto INTERPRETER_DEFAULT;
}
if (stack.size() < 2)
return set_error(serror, SCRIPT_ERR_INVALID_STACK_OPERATION);
@@ -982,6 +984,7 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, un
}
break;
INTERPRETER_DEFAULT:
default:
return set_error(serror, SCRIPT_ERR_BAD_OPCODE);
}

View File

@@ -9,6 +9,7 @@
#include "script/script.h"
#include "util.h"
#include "utilstrencodings.h"
#include "komodo_cryptoconditions.h"
#include <boost/foreach.hpp>
@@ -68,11 +69,13 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vector<vector<unsi
return true;
}
// Shortcut for pay-to-crypto-condition
if (scriptPubKey.IsPayToCryptoCondition()) {
typeRet = TX_CRYPTOCONDITION;
// TODO: Extract solutions
return true;
if (IsCryptoConditionsEnabled() {
// Shortcut for pay-to-crypto-condition
if (scriptPubKey.IsPayToCryptoCondition()) {
typeRet = TX_CRYPTOCONDITION;
// TODO: Extract solutions
return true;
}
}
// Scan templates