MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / BuildSpendingTransaction

Function BuildSpendingTransaction

src/bench/verify_script.cpp:35–50  ·  view source on GitHub ↗

FIXME: Dedup with BuildSpendingTransaction in test/script_tests.cpp.

Source from the content-addressed store, hash-verified

33
34// FIXME: Dedup with BuildSpendingTransaction in test/script_tests.cpp.
35static CMutableTransaction BuildSpendingTransaction(const CScript& scriptSig, const CMutableTransaction& txCredit)
36{
37 CMutableTransaction txSpend;
38 txSpend.nVersion = 1;
39 txSpend.nLockTime = 0;
40 txSpend.vin.resize(1);
41 txSpend.vout.resize(1);
42 txSpend.vin[0].prevout.hash = txCredit.GetHash();
43 txSpend.vin[0].prevout.n = 0;
44 txSpend.vin[0].scriptSig = scriptSig;
45 txSpend.vin[0].nSequence = CTxIn::SEQUENCE_FINAL;
46 txSpend.vout[0].scriptPubKey = CScript();
47 txSpend.vout[0].nValue = txCredit.vout[0].nValue;
48
49 return txSpend;
50}
51
52// Microbenchmark for verification of a basic P2WPKH script. Can be easily
53// modified to measure performance of other types of scripts.

Callers 1

VerifyScriptBenchFunction · 0.70

Calls 3

CScriptClass · 0.50
resizeMethod · 0.45
GetHashMethod · 0.45

Tested by

no test coverage detected