31 switch (script_type) {
52 keystore.
keys.emplace(key_id, privkey);
53 keystore.
pubkeys.emplace(key_id, pubkey);
57 switch (script_type) {
65 keystore.
tr_trees.emplace(output, builder);
76 const std::map<COutPoint, Coin> coins{
77 {txSpend.
vin[0].prevout,
Coin(txCredit.
vout[0], 100,
false)}
79 std::map<int, bilingual_str> input_errors;
84 txdata.Init(txSpend, {txCredit.
vout[0]});
91 txSpend.
vin[0].scriptSig,
92 txCredit.
vout[0].scriptPubKey,
93 &txSpend.
vin[0].scriptWitness,
108 std::vector<std::vector<unsigned char>> stack;
110 for (
int i = 0; i < 100; ++i) {
113 for (
int i = 0; i < 1000; ++i) {
116 for (
int i = 0; i < 100; ++i) {
120 .
setup([&] { stack.clear(); })
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a Bitcoin scriptPubKey for the given CTxDestination.
std::variant< CNoDestination, PubKeyDestination, PKHash, ScriptHash, WitnessV0ScriptHash, WitnessV0KeyHash, WitnessV1Taproot, PayToAnchor, WitnessUnknown > CTxDestination
A txout script categorized into standard templates.
An encapsulated private key.
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.
A reference to a CKey: the Hash160 of its serialized public key.
An encapsulated public key.
CKeyID GetID() const
Get the KeyID of this public key (hash of its serialization)
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.
Utility class to construct Taproot outputs from internal key and script tree.
WitnessV1Taproot GetOutput()
Compute scriptPubKey (after Finalize()).
TaprootBuilder & Add(int depth, std::span< const unsigned char > script, int leaf_version, bool track=true)
Add a new script at a certain depth in the tree.
TaprootBuilder & Finalize(const XOnlyPubKey &internal_key)
Finalize the construction.
static const XOnlyPubKey NUMS_H
Nothing Up My Sleeve point H Used as an internal key for provably disabling the key path spend see BI...
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.
Bench & unit(char const *unit)
Sets the operation unit.
detail::SetupRunner< SetupOp > setup(SetupOp setupOp)
Configure an untimed setup step per epoch (forces single-iteration epochs).
bool EvalScript(std::vector< std::vector< unsigned char > > &stack, const CScript &script, script_verify_flags flags, const BaseSignatureChecker &checker, SigVersion sigversion, ScriptExecutionData &execdata, ScriptError *serror)
bool VerifyScript(const CScript &scriptSig, const CScript &scriptPubKey, const CScriptWitness *witness, script_verify_flags flags, const BaseSignatureChecker &checker, ScriptError *serror)
@ BASE
Bare scripts and BIP16 P2SH-wrapped redeemscripts.
static constexpr uint8_t TAPROOT_LEAF_TAPSCRIPT
@ ASSERT_FAIL
Abort execution through assertion failure (for consensus code)
static constexpr script_verify_flags STANDARD_SCRIPT_VERIFY_FLAGS
Standard script verification flags that standard transactions will comply with.
void SignTransaction(CMutableTransaction &mtx, const SigningProvider *keystore, const std::map< COutPoint, Coin > &coins, const UniValue &hashType, UniValue &result)
Sign a transaction with the given keystore and previous transactions.
std::vector< unsigned char > ToByteVector(const T &in)
enum ScriptError_t ScriptError
A mutable version of CTransaction.
std::vector< CTxOut > vout
std::map< CKeyID, CPubKey > pubkeys
std::map< CKeyID, CKey > keys
std::map< XOnlyPubKey, TaprootBuilder > tr_trees
CMutableTransaction BuildSpendingTransaction(const CScript &scriptSig, const CScriptWitness &scriptWitness, const CTransaction &txCredit)
CMutableTransaction BuildCreditingTransaction(const CScript &scriptPubKey, int nValue)
static void VerifyNestedIfScript(benchmark::Bench &bench)
static void VerifyScriptP2TR_ScriptPath(benchmark::Bench &bench)
static void VerifyScriptP2WPKH(benchmark::Bench &bench)
static void VerifyScriptBench(benchmark::Bench &bench, ScriptType script_type)
static void VerifyScriptP2TR_KeyPath(benchmark::Bench &bench)
static size_t ExpectedWitnessStackSize(ScriptType script_type)
BENCHMARK(VerifyScriptP2WPKH)