28 const int witnessversion = 0;
32 static const std::array<unsigned char, 32> vchKey = {
34 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
37 key.
Set(vchKey.begin(), vchKey.end(),
false);
49 witness.
stack.emplace_back();
58 txSpend.
vin[0].scriptSig,
59 txCredit.
vout[0].scriptPubKey,
60 &txSpend.
vin[0].scriptWitness,
71 std::vector<std::vector<unsigned char>> stack;
73 for (
int i = 0; i < 100; ++i) {
76 for (
int i = 0; i < 1000; ++i) {
79 for (
int i = 0; i < 100; ++i) {
83 auto stack_copy = stack;
A hasher class for Bitcoin's 160-bit hash (SHA-256 + RIPEMD-160).
void Finalize(Span< unsigned char > output)
CHash160 & Write(Span< const unsigned char > input)
An encapsulated private key.
bool Sign(const uint256 &hash, std::vector< unsigned char > &vchSig, bool grind=true, uint32_t test_case=0) const
Create a DER-serialized signature.
CPubKey GetPubKey() const
Compute the public key from a private key.
void Set(const T pbegin, const T pend, bool fCompressedIn)
Initialize using begin and end iterators to byte data.
An encapsulated public key.
Serialized script, used inside transaction inputs and outputs.
The basic transaction that is broadcasted on the network and contained in blocks.
RAII class initializing and deinitializing global state for elliptic curve support.
Main entry point to nanobench's benchmarking facility.
Bench & run(char const *benchmarkName, Op &&op)
Repeatedly calls op() based on the configuration, and performs measurements.
uint256 SignatureHash(const CScript &scriptCode, const T &txTo, unsigned int nIn, int32_t nHashType, const CAmount &amount, SigVersion sigversion, const PrecomputedTransactionData *cache)
bool EvalScript(std::vector< std::vector< unsigned char > > &stack, const CScript &script, unsigned int flags, const BaseSignatureChecker &checker, SigVersion sigversion, ScriptExecutionData &execdata, ScriptError *serror)
bool VerifyScript(const CScript &scriptSig, const CScript &scriptPubKey, const CScriptWitness *witness, unsigned int flags, const BaseSignatureChecker &checker, ScriptError *serror)
@ BASE
Bare scripts and BIP16 P2SH-wrapped redeemscripts.
@ WITNESS_V0
Witness v0 (P2WPKH and P2WSH); see BIP 141.
@ ASSERT_FAIL
Abort execution through assertion failure (for consensus code)
std::vector< unsigned char > ToByteVector(const T &in)
enum ScriptError_t ScriptError
A mutable version of CTransaction.
std::vector< CTxOut > vout
std::vector< std::vector< unsigned char > > stack
CMutableTransaction BuildSpendingTransaction(const CScript &scriptSig, const CScriptWitness &scriptWitness, const CTransaction &txCredit)
CMutableTransaction BuildCreditingTransaction(const CScript &scriptPubKey, int nValue)
BENCHMARK(VerifyScriptBench, benchmark::PriorityLevel::HIGH)
static void VerifyScriptBench(benchmark::Bench &bench)
static void VerifyNestedIfScript(benchmark::Bench &bench)