ImportPayout cc eval code and alot of general cc polish. tests to write

This commit is contained in:
Scott Sadler
2018-03-30 15:46:41 -03:00
parent 991c422a9d
commit 2c8d8268dd
25 changed files with 389 additions and 116 deletions

View File

@@ -7,6 +7,8 @@
#include "tinyformat.h"
#include "utilstrencodings.h"
#include "komodo_cc.h"
#include "cryptoconditions/include/cryptoconditions.h"
namespace {
inline std::string ValueString(const std::vector<unsigned char>& vch)
@@ -238,6 +240,20 @@ bool CScript::IsPayToCryptoCondition() const
return 0;
}
bool CScript::MayAcceptCryptoCondition() const
{
// Get the type mask of the condition
const_iterator pc = this->begin();
vector<unsigned char> data;
opcodetype opcode;
if (!this->GetOp(pc, opcode, data)) return false;
if (!(opcode > OP_0 && opcode < OP_PUSHDATA1)) return false;
CC *cond = cc_readConditionBinary(data.data(), data.size());
if (!cond) return false;
bool accept = IsAcceptableCryptoCondition(cond);
return accept;
}
bool CScript::IsPushOnly() const
{
const_iterator pc = begin();