7 #if defined(HAVE_CONSENSUS_LIB) 24 const int witnessversion = 0;
28 static const std::array<unsigned char, 32> vchKey = {
30 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
33 key.
Set(vchKey.begin(), vchKey.end(),
false);
45 witness.
stack.emplace_back();
54 txSpend.
vin[0].scriptSig,
55 txCredit.
vout[0].scriptPubKey,
56 &txSpend.
vin[0].scriptWitness,
63 #if defined(HAVE_CONSENSUS_LIB) 67 txCredit.
vout[0].scriptPubKey.data(),
68 txCredit.
vout[0].scriptPubKey.size(),
69 txCredit.
vout[0].nValue,
70 (
const unsigned char*)stream.
data(), stream.
size(), 0,
flags,
nullptr);
79 std::vector<std::vector<unsigned char>> stack;
81 for (
int i = 0; i < 100; ++i) {
84 for (
int i = 0; i < 1000; ++i) {
87 for (
int i = 0; i < 100; ++i) {
91 auto stack_copy = stack;
CMutableTransaction BuildCreditingTransaction(const CScript &scriptPubKey, int nValue)
Witness v0 (P2WPKH and P2WSH); see BIP 141.
enum ScriptError_t ScriptError
void Finalize(Span< unsigned char > output)
CPubKey GetPubKey() const
Compute the public key from a private key.
bool VerifyScript(const CScript &scriptSig, const CScript &scriptPubKey, const CScriptWitness *witness, unsigned int flags, const BaseSignatureChecker &checker, ScriptError *serror)
std::vector< std::vector< unsigned char > > stack
CMutableTransaction BuildSpendingTransaction(const CScript &scriptSig, const CScriptWitness &scriptWitness, const CTransaction &txCredit)
Bare scripts and BIP16 P2SH-wrapped redeemscripts.
static void VerifyNestedIfScript(benchmark::Bench &bench)
bool Sign(const uint256 &hash, std::vector< unsigned char > &vchSig, bool grind=true, uint32_t test_case=0) const
Create a DER-serialized signature.
static void VerifyScriptBench(benchmark::Bench &bench)
Abort execution through assertion failure (for consensus code)
Bench & run(char const *benchmarkName, Op &&op)
Repeatedly calls op() based on the configuration, and performs measurements.
An encapsulated public key.
std::vector< CTxOut > vout
void Set(const T pbegin, const T pend, bool fCompressedIn)
Initialize using begin and end iterators to byte data.
BENCHMARK(VerifyScriptBench, benchmark::PriorityLevel::HIGH)
std::vector< unsigned char > ToByteVector(const T &in)
int bitcoinconsensus_verify_script_with_amount(const unsigned char *scriptPubKey, unsigned int scriptPubKeyLen, int64_t amount, const unsigned char *txTo, unsigned int txToLen, unsigned int nIn, unsigned int flags, bitcoinconsensus_error *err)
bool error(const char *fmt, const Args &... args)
Serialized script, used inside transaction inputs and outputs.
static const int PROTOCOL_VERSION
network protocol versioning
uint256 SignatureHash(const CScript &scriptCode, const T &txTo, unsigned int nIn, int nHashType, const CAmount &amount, SigVersion sigversion, const PrecomputedTransactionData *cache)
A mutable version of CTransaction.
Main entry point to nanobench's benchmarking facility.
An encapsulated private key.
The basic transaction that is broadcasted on the network and contained in blocks. ...
A hasher class for Bitcoin's 160-bit hash (SHA-256 + RIPEMD-160).
bool EvalScript(std::vector< std::vector< unsigned char > > &stack, const CScript &script, unsigned int flags, const BaseSignatureChecker &checker, SigVersion sigversion, ScriptExecutionData &execdata, ScriptError *serror)
CHash160 & Write(Span< const unsigned char > input)