Bitcoin ABC 0.34.2
P2P Digital Currency
verify_script.cpp
Go to the documentation of this file.
1// Copyright (c) 2016-2018 The Bitcoin Core developers
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5#include <bench/bench.h>
6#include <key.h>
7#if defined(HAVE_CONSENSUS_LIB)
9#endif
10#include <script/interpreter.h>
11#include <script/script.h>
12#include <script/script_error.h>
13#include <streams.h>
14#include <test/util/transaction_utils.h>
15
16#include <array>
17
19 std::vector<std::vector<uint8_t>> stack;
20 CScript script;
21 for (int i = 0; i < 100; ++i) {
22 script << OP_1 << OP_IF;
23 }
24 for (int i = 0; i < 1000; ++i) {
25 script << OP_1;
26 }
27 for (int i = 0; i < 100; ++i) {
29 }
30 bench.run([&] {
31 auto stack_copy = stack;
32 ScriptExecutionMetrics metrics = {};
33 ScriptError error;
34 bool ret = EvalScript(stack_copy, script, 0, BaseSignatureChecker(),
35 metrics, &error);
36 assert(ret);
37 });
38}
39
Main entry point to nanobench's benchmarking facility.
Definition: nanobench.h:616
Bench & run(char const *benchmarkName, Op &&op)
Repeatedly calls op() based on the configuration, and performs measurements.
Definition: nanobench.h:1183
bool EvalScript(std::vector< valtype > &stack, const CScript &script, uint32_t flags, const BaseSignatureChecker &checker, ScriptExecutionMetrics &metrics, ScriptError *serror)
@ OP_IF
Definition: script.h:83
@ OP_ENDIF
Definition: script.h:88
@ OP_1
Definition: script.h:62
ScriptError
Definition: script_error.h:11
Struct for holding cumulative results from executing a script or a sequence of scripts.
assert(!tx.IsCoinBase())
BENCHMARK(VerifyNestedIfScript)
static void VerifyNestedIfScript(benchmark::Bench &bench)