34 std::vector<CScript> prev_spks;
37 for (
int i = 0; i < 32; i++) {
41 keystore.
keys.emplace(key_id, privkey);
42 keystore.
pubkeys.emplace(key_id, pubkey);
51 prev_spks.push_back(prev_spk);
58 unsigned_tx.
vin.emplace_back(prevout);
64 std::map<COutPoint, Coin> coins;
65 const CScript& prev_spk = prev_spks[(iter++) % prev_spks.size()];
66 coins[prevout] =
Coin(
CTxOut(10000, prev_spk), 100,
false);
67 std::map<int, bilingual_str> input_errors;
83 auto merkle_root = use_null_merkle_root ?
uint256() : rng.
rand256();
85 std::vector<unsigned char> sig(64);
88 bool success = key.SignSchnorr(
msg, sig, &merkle_root, aux);
BENCHMARK(SignTransactionECDSA, benchmark::PriorityLevel::HIGH)
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.
static void SignSchnorrWithMerkleRoot(benchmark::Bench &bench)
RAII class initializing and deinitializing global state for elliptic curve support.
CPubKey GetPubKey() const
Compute the public key from a private key.
std::map< CKeyID, CKey > keys
static void SignSchnorrTapTweakBenchmark(benchmark::Bench &bench, bool use_null_merkle_root)
CKeyID GetID() const
Get the KeyID of this public key (hash of its serialization)
CKey GenerateRandomKey(bool compressed) noexcept
ANKERL_NANOBENCH(NODISCARD) std Bench & minEpochIterations(uint64_t numIters) noexcept
Sets the minimum number of iterations each epoch should take.
Bench & run(char const *benchmarkName, Op &&op)
Repeatedly calls op() based on the configuration, and performs measurements.
An encapsulated public key.
std::map< CKeyID, CPubKey > pubkeys
An output of a transaction.
An outpoint - a combination of a transaction hash and an index n into its vout.
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a Bitcoin scriptPubKey for the given CTxDestination.
static void SignTransactionECDSA(benchmark::Bench &bench)
static void SignTransactionSingleInput(benchmark::Bench &bench, InputType input_type)
Serialized script, used inside transaction inputs and outputs.
static transaction_identifier FromUint256(const uint256 &id)
uint256 rand256() noexcept
generate a random uint256.
A reference to a CKey: the Hash160 of its serialized public key.
A mutable version of CTransaction.
Main entry point to nanobench's benchmarking facility.
An encapsulated private key.
static void SignSchnorrWithNullMerkleRoot(benchmark::Bench &bench)
static void SignTransactionSchnorr(benchmark::Bench &bench)