This commit is contained in:
Scott Sadler
2018-04-16 22:57:35 -05:00
parent 3205a566d4
commit 0cb91a8d20
30 changed files with 1002 additions and 289 deletions

View File

@@ -3,17 +3,20 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <cryptoconditions.h>
#include "interpreter.h"
#include "consensus/upgrades.h"
#include "primitives/transaction.h"
#include "cc/eval.h"
#include "crypto/ripemd160.h"
#include "crypto/sha1.h"
#include "crypto/sha256.h"
#include "pubkey.h"
#include "script/script.h"
#include "uint256.h"
#include "cryptoconditions/include/cryptoconditions.h"
using namespace std;

View File

@@ -186,5 +186,4 @@ bool VerifyScript(
const BaseSignatureChecker& checker,
uint32_t consensusBranchId,
ScriptError* serror = NULL);
#endif // BITCOIN_SCRIPT_INTERPRETER_H

View File

@@ -8,8 +8,10 @@
#include "tinyformat.h"
#include "utilstrencodings.h"
#include "script/cc.h"
#include "cc/eval.h"
#include "cryptoconditions/include/cryptoconditions.h"
namespace {
inline std::string ValueString(const std::vector<unsigned char>& vch)
{
@@ -266,6 +268,17 @@ bool CScript::MayAcceptCryptoCondition() const
return out;
}
bool CScript::IsCoinImport() const
{
const_iterator pc = this->begin();
vector<unsigned char> data;
opcodetype opcode;
if (this->GetOp(pc, opcode, data))
if (opcode > OP_0 && opcode <= OP_PUSHDATA4)
return data.begin()[0] == EVAL_IMPORTCOIN;
return false;
}
bool CScript::IsPushOnly() const
{
const_iterator pc = begin();

View File

@@ -570,6 +570,7 @@ public:
bool IsPayToScriptHash() const;
bool IsPayToCryptoCondition() const;
bool IsCoinImport() const;
bool MayAcceptCryptoCondition() const;
/** Called by IsStandardTx and P2SH/BIP62 VerifyScript (which makes it consensus-critical). */