Bitcoin ABC  0.28.12
P2P Digital Currency
Macros | Functions
interpreter.cpp File Reference
#include <script/interpreter.h>
#include <crypto/ripemd160.h>
#include <crypto/sha1.h>
#include <crypto/sha256.h>
#include <pubkey.h>
#include <script/bitfield.h>
#include <script/script.h>
#include <script/sigencoding.h>
#include <uint256.h>
#include <util/bitmanip.h>
Include dependency graph for interpreter.cpp:

Go to the source code of this file.

Macros

#define stacktop(i)   (stack.at(stack.size() + (i)))
 Script is a stack machine (like Forth) that evaluates a predicate returning a bool indicating valid or not. More...
 
#define altstacktop(i)   (altstack.at(altstack.size() + (i)))
 

Functions

bool CastToBool (const valtype &vch)
 
static void popstack (std::vector< valtype > &stack)
 
int FindAndDelete (CScript &script, const CScript &b)
 
static void CleanupScriptCode (CScript &scriptCode, const std::vector< uint8_t > &vchSig, uint32_t flags)
 
static bool IsOpcodeDisabled (opcodetype opcode, uint32_t flags)
 
static bool EvalChecksig (const valtype &vchSig, const valtype &vchPubKey, CScript::const_iterator pbegincodehash, CScript::const_iterator pend, uint32_t flags, const BaseSignatureChecker &checker, ScriptExecutionMetrics &metrics, ScriptError *serror, bool &fSuccess)
 Helper for OP_CHECKSIG and OP_CHECKSIGVERIFY. More...
 
bool EvalScript (std::vector< valtype > &stack, const CScript &script, uint32_t flags, const BaseSignatureChecker &checker, ScriptExecutionMetrics &metrics, ScriptError *serror)
 
template<class T >
uint256 SignatureHash (const CScript &scriptCode, const T &txTo, unsigned int nIn, SigHashType sigHashType, const Amount amount, const PrecomputedTransactionData *cache, uint32_t flags)
 
bool VerifyScript (const CScript &scriptSig, const CScript &scriptPubKey, uint32_t flags, const BaseSignatureChecker &checker, ScriptExecutionMetrics &metricsOut, ScriptError *serror)
 Execute an unlocking and locking script together. More...
 

Macro Definition Documentation

◆ altstacktop

#define altstacktop (   i)    (altstack.at(altstack.size() + (i)))

Definition at line 37 of file interpreter.cpp.

◆ stacktop

#define stacktop (   i)    (stack.at(stack.size() + (i)))

Script is a stack machine (like Forth) that evaluates a predicate returning a bool indicating valid or not.

There are no loops.

Definition at line 36 of file interpreter.cpp.

Function Documentation

◆ CastToBool()

bool CastToBool ( const valtype vch)

Definition at line 19 of file interpreter.cpp.

Here is the caller graph for this function:

◆ CleanupScriptCode()

static void CleanupScriptCode ( CScript scriptCode,
const std::vector< uint8_t > &  vchSig,
uint32_t  flags 
)
static

Definition at line 73 of file interpreter.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ EvalChecksig()

static bool EvalChecksig ( const valtype vchSig,
const valtype vchPubKey,
CScript::const_iterator  pbegincodehash,
CScript::const_iterator  pend,
uint32_t  flags,
const BaseSignatureChecker checker,
ScriptExecutionMetrics metrics,
ScriptError serror,
bool &  fSuccess 
)
static

Helper for OP_CHECKSIG and OP_CHECKSIGVERIFY.

A return value of false means the script fails entirely. When true is returned, the fSuccess variable indicates whether the signature check itself succeeded.

Definition at line 173 of file interpreter.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ EvalScript()

bool EvalScript ( std::vector< valtype > &  stack,
const CScript script,
uint32_t  flags,
const BaseSignatureChecker checker,
ScriptExecutionMetrics metrics,
ScriptError serror 
)

Definition at line 203 of file interpreter.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FindAndDelete()

int FindAndDelete ( CScript script,
const CScript b 
)

Definition at line 45 of file interpreter.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsOpcodeDisabled()

static bool IsOpcodeDisabled ( opcodetype  opcode,
uint32_t  flags 
)
static

Definition at line 83 of file interpreter.cpp.

Here is the caller graph for this function:

◆ popstack()

static void popstack ( std::vector< valtype > &  stack)
inlinestatic

Definition at line 38 of file interpreter.cpp.

Here is the caller graph for this function:

◆ SignatureHash()

template<class T >
uint256 SignatureHash ( const CScript scriptCode,
const T &  txTo,
unsigned int  nIn,
SigHashType  sigHashType,
const Amount  amount,
const PrecomputedTransactionData cache,
uint32_t  flags 
)

Definition at line 1566 of file interpreter.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ VerifyScript()

bool VerifyScript ( const CScript scriptSig,
const CScript scriptPubKey,
uint32_t  flags,
const BaseSignatureChecker checker,
ScriptExecutionMetrics metricsOut,
ScriptError serror = nullptr 
)

Execute an unlocking and locking script together.

Upon success, metrics will hold the accumulated script metrics. (upon failure, the results should not be relied on)

Definition at line 1777 of file interpreter.cpp.

Here is the call graph for this function:
Here is the caller graph for this function: