Merge branch 'dev' of https://github.com/jl777/komodo into trunk-merge

* 'dev' of https://github.com/jl777/komodo: (1062 commits)
  Delay PoW check until connect block
  Declare
  KOMODO_NEWBLOCKS
  Prevent autorewind if syncing. Not a critical update
  Change n0/n1 size to int32_t
  Syntax
  Fix n -> static n0/n1
  Test
  Test
  Test
  KOMODO_LONGESTCHAIN = height;
  Sync main.cpp to jl777
  -print
  -USD/EUR
  readme
  curl fix
  -print
  Fix buffer overflows and reduce KMD men usage
  -print
  Test
  ...
This commit is contained in:
Scott Grayson
2018-04-15 21:59:37 -04:00
913 changed files with 112652 additions and 11809 deletions

View File

@@ -7,6 +7,8 @@
#include "tinyformat.h"
#include "utilstrencodings.h"
#include "script/cc.h"
#include "cryptoconditions/include/cryptoconditions.h"
namespace {
inline std::string ValueString(const std::vector<unsigned char>& vch)
@@ -138,8 +140,11 @@ const char* GetOpName(opcodetype opcode)
case OP_CHECKSIGVERIFY : return "OP_CHECKSIGVERIFY";
case OP_CHECKMULTISIG : return "OP_CHECKMULTISIG";
case OP_CHECKMULTISIGVERIFY : return "OP_CHECKMULTISIGVERIFY";
case OP_CHECKCRYPTOCONDITION : return "OP_CHECKCRYPTOCONDITION";
case OP_CHECKCRYPTOCONDITIONVERIFY
: return "OP_CHECKCRYPTOCONDITIONVERIFY";
// expanson
// expansion
case OP_NOP1 : return "OP_NOP1";
case OP_NOP2 : return "OP_NOP2";
case OP_NOP3 : return "OP_NOP3";
@@ -231,6 +236,36 @@ bool CScript::IsPayToScriptHash() const
this->at(22) == OP_EQUAL);
}
bool CScript::IsPayToCryptoCondition() const
{
const_iterator pc = this->begin();
vector<unsigned char> data;
opcodetype opcode;
if (this->GetOp(pc, opcode, data))
// Sha256 conditions are <76 bytes
if (opcode > OP_0 && opcode < OP_PUSHDATA1)
if (this->GetOp(pc, opcode, data))
if (opcode == OP_CHECKCRYPTOCONDITION)
if (pc == this->end())
return 1;
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 out = IsSupportedCryptoCondition(cond);
cc_free(cond);
return out;
}
bool CScript::IsPushOnly() const
{
const_iterator pc = begin();