HomePhabricator

refactor: test/bench: dedup Build{Crediting,Spending}Transaction()

Description

refactor: test/bench: dedup Build{Crediting,Spending}Transaction()

Summary:
prototypes used in src/test/script_tests.cpp:

  • CMutableTransaction BuildCreditingTransaction(const CScript& scriptPubKey, int nValue = 0);
  • CMutableTransaction BuildSpendingTransaction(const CScript& scriptSig, const CScriptWitness& scriptWitness, const CTransaction& txCredit);

prototypes used in bench/verify_script.cpp:

  • CMutableTransaction BuildCreditingTransaction(const CScript& scriptPubKey);
  • CMutableTransaction BuildSpendingTransaction(const CScript& scriptSig, const CMutableTransaction& txCredit);

The more generic versions from the script tests are moved into a new file pair
transaction_utils.cpp/h and the calls are adapted accordingly in the
verify_script benchmark (passing the nValue of 1 explicitely for
BuildCreditingTransaction(), passing empty scriptWitness explicitely and
converting txCredit parameter to CTransaction in BuildSpendingTransaction()).

This is a backport of Core PR17183

The benchmark in question was deleted because segwit dependent, but it may be a good time to resurrect it.

Test Plan:

make check
ninja check

Reviewers: #bitcoin_abc, jasonbcox

Reviewed By: #bitcoin_abc, jasonbcox

Differential Revision: https://reviews.bitcoinabc.org/D5806

Details

Provenance
Sebastian Falbesoner <sebastian.falbesoner@gmail.com>Authored on Oct 18 2019, 00:05
deadalnixCommitted on Apr 22 2020, 20:07
deadalnixPushed on Apr 22 2020, 20:07
Reviewer
Restricted Project
Differential Revision
D5806: refactor: test/bench: dedup Build{Crediting,Spending}Transaction()
Parents
rABC1b7b18cbca53: [backport#14783] qt: Call noui_connect to prevent boost::signals2…
Branches
Unknown
Tags
Unknown