guard cryptoconditions
This commit is contained in:
@@ -1,8 +1,19 @@
|
|||||||
|
#ifndef KOMODO_CRYPTOCONDITIONS_H
|
||||||
|
#define KOMODO_CRYPTOCONDITIONS_H
|
||||||
|
|
||||||
|
#include "cryptoconditions/include/cryptoconditions.h"
|
||||||
|
|
||||||
|
extern int32_t ASSETCHAINS_CC;
|
||||||
|
|
||||||
|
static bool IsCryptoConditionsEnabled() {
|
||||||
|
return 0 != ASSETCHAINS_CC;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Method stub for aux conditions. Unimplemented, thus fails if an aux condition is encountered.
|
* Method stub for aux conditions. Unimplemented, thus fails if an aux condition is encountered.
|
||||||
*/
|
*/
|
||||||
int komodoCCAux(CC *cond, void *context) {
|
static int komodoCCAux(CC *cond, void *context) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* KOMODO_CRYPTOCONDITIONS_H */
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
#include "pubkey.h"
|
#include "pubkey.h"
|
||||||
#include "script/script.h"
|
#include "script/script.h"
|
||||||
#include "uint256.h"
|
#include "uint256.h"
|
||||||
#include "cryptoconditions/include/cryptoconditions.h"
|
|
||||||
#include "komodo_cryptoconditions.h"
|
#include "komodo_cryptoconditions.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -940,7 +939,9 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, un
|
|||||||
case OP_CHECKCRYPTOCONDITION:
|
case OP_CHECKCRYPTOCONDITION:
|
||||||
case OP_CHECKCRYPTOCONDITIONVERIFY:
|
case OP_CHECKCRYPTOCONDITIONVERIFY:
|
||||||
{
|
{
|
||||||
// (fulfillment condition -- bool)
|
if (!IsCryptoConditionsEnabled()) {
|
||||||
|
goto INTERPRETER_DEFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
if (stack.size() < 2)
|
if (stack.size() < 2)
|
||||||
return set_error(serror, SCRIPT_ERR_INVALID_STACK_OPERATION);
|
return set_error(serror, SCRIPT_ERR_INVALID_STACK_OPERATION);
|
||||||
@@ -982,6 +983,7 @@ bool EvalScript(vector<vector<unsigned char> >& stack, const CScript& script, un
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
INTERPRETER_DEFAULT:
|
||||||
default:
|
default:
|
||||||
return set_error(serror, SCRIPT_ERR_BAD_OPCODE);
|
return set_error(serror, SCRIPT_ERR_BAD_OPCODE);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include "script/script.h"
|
#include "script/script.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "utilstrencodings.h"
|
#include "utilstrencodings.h"
|
||||||
|
#include "komodo_cryptoconditions.h"
|
||||||
|
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
|
|
||||||
@@ -68,11 +69,13 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vector<vector<unsi
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shortcut for pay-to-crypto-condition
|
if (IsCryptoConditionsEnabled()) {
|
||||||
if (scriptPubKey.IsPayToCryptoCondition()) {
|
// Shortcut for pay-to-crypto-condition
|
||||||
typeRet = TX_CRYPTOCONDITION;
|
if (scriptPubKey.IsPayToCryptoCondition()) {
|
||||||
// TODO: Extract solutions
|
typeRet = TX_CRYPTOCONDITION;
|
||||||
return true;
|
// TODO: Extract solutions
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scan templates
|
// Scan templates
|
||||||
|
|||||||
Reference in New Issue
Block a user