Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
#include <script/script_error.h>
#include <primitives/transaction.h>
#include <vector>
#include <stdint.h>
#include <string>
Go to the source code of this file.
Classes | |
struct | PrecomputedTransactionData |
class | BaseSignatureChecker |
class | TransactionSignatureChecker |
class | MutableTransactionSignatureChecker |
Enumerations | |
enum | { SIGHASH_ALL = 1, SIGHASH_NONE = 2, SIGHASH_SINGLE = 3, SIGHASH_ANYONECANPAY = 0x80 } |
Signature hash types/flags. More... | |
enum | { SCRIPT_VERIFY_NONE = 0, SCRIPT_VERIFY_P2SH = (1U << 0), SCRIPT_VERIFY_STRICTENC = (1U << 1), SCRIPT_VERIFY_DERSIG = (1U << 2), SCRIPT_VERIFY_LOW_S = (1U << 3), SCRIPT_VERIFY_NULLDUMMY = (1U << 4), SCRIPT_VERIFY_SIGPUSHONLY = (1U << 5), SCRIPT_VERIFY_MINIMALDATA = (1U << 6), SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS = (1U << 7), SCRIPT_VERIFY_CLEANSTACK = (1U << 8), SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY = (1U << 9), SCRIPT_VERIFY_CHECKSEQUENCEVERIFY = (1U << 10), SCRIPT_VERIFY_NULLFAIL = (1U << 14) } |
Script verification flags. More... | |
enum | SigVersion { SIGVERSION_BASE = 0 } |
Functions | |
bool | CheckSignatureEncoding (const std::vector< unsigned char > &vchSig, unsigned int flags, ScriptError *serror) |
uint256 | SignatureHash (const CScript &scriptCode, const CTransaction &txTo, unsigned int nIn, int nHashType, const CAmount &amount, SigVersion sigversion, const PrecomputedTransactionData *cache=nullptr) |
bool | EvalScript (std::vector< std::vector< unsigned char > > &stack, const CScript &script, unsigned int flags, const BaseSignatureChecker &checker, SigVersion sigversion, ScriptError *error=nullptr) |
bool | VerifyScript (const CScript &scriptSig, const CScript &scriptPubKey, unsigned int flags, const BaseSignatureChecker &checker, ScriptError *error=nullptr) |
Enumeration Type Documentation
◆ anonymous enum
anonymous enum |
Signature hash types/flags.
Enumerator | |
---|---|
SIGHASH_ALL | |
SIGHASH_NONE | |
SIGHASH_SINGLE | |
SIGHASH_ANYONECANPAY |
Definition at line 22 of file interpreter.h.
◆ anonymous enum
anonymous enum |
Script verification flags.
All flags are intended to be soft forks: the set of acceptable scripts under flags (A | B) is a subset of the acceptable scripts under flag (A).
Definition at line 35 of file interpreter.h.
◆ SigVersion
enum SigVersion |
Enumerator | |
---|---|
SIGVERSION_BASE |
Definition at line 109 of file interpreter.h.
Function Documentation
◆ CheckSignatureEncoding()
bool CheckSignatureEncoding | ( | const std::vector< unsigned char > & | vchSig, |
unsigned int | flags, | ||
ScriptError * | serror | ||
) |
Definition at line 188 of file interpreter.cpp.
References flags, IsDefinedHashtypeSignature(), IsLowDERSignature(), IsValidSignatureEncoding(), SCRIPT_ERR_SIG_DER, SCRIPT_ERR_SIG_HASHTYPE, SCRIPT_VERIFY_DERSIG, SCRIPT_VERIFY_LOW_S, and SCRIPT_VERIFY_STRICTENC.
Referenced by EvalScript(), and ScriptToAsmStr().
◆ EvalScript()
bool EvalScript | ( | std::vector< std::vector< unsigned char > > & | stack, |
const CScript & | script, | ||
unsigned int | flags, | ||
const BaseSignatureChecker & | checker, | ||
SigVersion | sigversion, | ||
ScriptError * | error = nullptr |
||
) |
Definition at line 235 of file interpreter.cpp.
References altstacktop, prevector< N, T, Size, Diff >::begin(), CastToBool(), BaseSignatureChecker::CheckLockTime(), CheckMinimalPush(), CheckPubKeyEncoding(), BaseSignatureChecker::CheckSequence(), BaseSignatureChecker::CheckSig(), CheckSignatureEncoding(), count, prevector< N, T, Size, Diff >::end(), CScript::FindAndDelete(), flags, CScriptNum::getint(), CScript::GetOp(), CScriptNum::getvch(), MAX_OPS_PER_SCRIPT, MAX_PUBKEYS_PER_MULTISIG, MAX_SCRIPT_ELEMENT_SIZE, MAX_SCRIPT_SIZE, MAX_STACK_SIZE, OP_0NOTEQUAL, OP_1, OP_10, OP_11, OP_12, OP_13, OP_14, OP_15, OP_16, OP_1ADD, OP_1NEGATE, OP_1SUB, OP_2, OP_2DIV, OP_2DROP, OP_2DUP, OP_2MUL, OP_2OVER, OP_2ROT, OP_2SWAP, OP_3, OP_3DUP, OP_4, OP_5, OP_6, OP_7, OP_8, OP_9, OP_ABS, OP_ADD, OP_AND, OP_BOOLAND, OP_BOOLOR, OP_CAT, OP_CHECKLOCKTIMEVERIFY, OP_CHECKMULTISIG, OP_CHECKMULTISIGVERIFY, OP_CHECKSEQUENCEVERIFY, OP_CHECKSIG, OP_CHECKSIGVERIFY, OP_CODESEPARATOR, OP_DEPTH, OP_DIV, OP_DROP, OP_DUP, OP_ELSE, OP_ENDIF, OP_EQUAL, OP_EQUALVERIFY, OP_FROMALTSTACK, OP_GREATERTHAN, OP_GREATERTHANOREQUAL, OP_HASH160, OP_HASH256, OP_IF, OP_IFDUP, OP_INVERT, OP_LEFT, OP_LESSTHAN, OP_LESSTHANOREQUAL, OP_LSHIFT, OP_MAX, OP_MIN, OP_MOD, OP_MUL, OP_NEGATE, OP_NIP, OP_NOP, OP_NOP1, OP_NOP10, OP_NOP4, OP_NOP5, OP_NOP6, OP_NOP7, OP_NOP8, OP_NOP9, OP_NOT, OP_NOTIF, OP_NUMEQUAL, OP_NUMEQUALVERIFY, OP_NUMNOTEQUAL, OP_OR, OP_OVER, OP_PICK, OP_PUSHDATA4, OP_RETURN, OP_RIGHT, OP_RIPEMD160, OP_ROLL, OP_ROT, OP_RSHIFT, OP_SHA1, OP_SHA256, OP_SIZE, OP_SUB, OP_SUBSTR, OP_SWAP, OP_TOALTSTACK, OP_TUCK, OP_VERIFY, OP_WITHIN, OP_XOR, popstack(), SCRIPT_ERR_BAD_OPCODE, SCRIPT_ERR_CHECKMULTISIGVERIFY, SCRIPT_ERR_CHECKSIGVERIFY, SCRIPT_ERR_DISABLED_OPCODE, SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS, SCRIPT_ERR_EQUALVERIFY, SCRIPT_ERR_INVALID_ALTSTACK_OPERATION, SCRIPT_ERR_INVALID_STACK_OPERATION, SCRIPT_ERR_MINIMALDATA, SCRIPT_ERR_NEGATIVE_LOCKTIME, SCRIPT_ERR_NUMEQUALVERIFY, SCRIPT_ERR_OP_COUNT, SCRIPT_ERR_OP_RETURN, SCRIPT_ERR_PUBKEY_COUNT, SCRIPT_ERR_PUSH_SIZE, SCRIPT_ERR_SCRIPT_SIZE, SCRIPT_ERR_SIG_COUNT, SCRIPT_ERR_SIG_NULLDUMMY, SCRIPT_ERR_SIG_NULLFAIL, SCRIPT_ERR_STACK_SIZE, SCRIPT_ERR_UNBALANCED_CONDITIONAL, SCRIPT_ERR_UNKNOWN_ERROR, SCRIPT_ERR_UNSATISFIED_LOCKTIME, SCRIPT_ERR_VERIFY, SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY, SCRIPT_VERIFY_CHECKSEQUENCEVERIFY, SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS, SCRIPT_VERIFY_MINIMALDATA, SCRIPT_VERIFY_NULLDUMMY, SCRIPT_VERIFY_NULLFAIL, CTxIn::SEQUENCE_LOCKTIME_DISABLE_FLAG, SIGVERSION_BASE, prevector< N, T, Size, Diff >::size(), stacktop, CRIPEMD160::Write(), CSHA1::Write(), CSHA256::Write(), CHash256::Write(), and CHash160::Write().
Referenced by AreInputsStandard(), and VerifyScript().
◆ SignatureHash()
uint256 SignatureHash | ( | const CScript & | scriptCode, |
const CTransaction & | txTo, | ||
unsigned int | nIn, | ||
int | nHashType, | ||
const CAmount & | amount, | ||
SigVersion | sigversion, | ||
const PrecomputedTransactionData * | cache = nullptr |
||
) |
Definition at line 1156 of file interpreter.cpp.
References CHashWriter::GetHash(), SER_GETHASH, SIGHASH_SINGLE, uint256S(), CTransaction::vin, and CTransaction::vout.
Referenced by TransactionSignatureChecker::CheckSig(), and TransactionSignatureCreator::CreateSig().
◆ VerifyScript()
bool VerifyScript | ( | const CScript & | scriptSig, |
const CScript & | scriptPubKey, | ||
unsigned int | flags, | ||
const BaseSignatureChecker & | checker, | ||
ScriptError * | error = nullptr |
||
) |
Definition at line 1287 of file interpreter.cpp.
References CastToBool(), EvalScript(), flags, CScript::IsPayToScriptHash(), CScript::IsPushOnly(), popstack(), SCRIPT_ERR_CLEANSTACK, SCRIPT_ERR_EVAL_FALSE, SCRIPT_ERR_SIG_PUSHONLY, SCRIPT_ERR_UNKNOWN_ERROR, SCRIPT_VERIFY_CLEANSTACK, SCRIPT_VERIFY_P2SH, SCRIPT_VERIFY_SIGPUSHONLY, and SIGVERSION_BASE.
Referenced by dashconsensus_verify_script(), CPrivateSendServer::IsInputScriptSigValid(), MutateTxSign(), CScriptCheck::operator()(), ProduceSignature(), and signrawtransaction().