Page MenuHomePhabricator

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

Authored by deadalnix on Apr 22 2020, 15:52.

Details

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

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

[Bot Message]
One or more PR numbers were detected in the summary.
Links to those PRs have been inserted into the summary for reference.

This revision is now accepted and ready to land.Apr 22 2020, 18:35