Skip to content

Commit 3718ae2

Browse files
committed
[tests] Don't initialize PrecomputedTransactionData in txvalidationcache tests
PrecomputedTransactionData is initialized inside CheckInputScripts(). No need to pre-initialize it before calling into CheckInputScripts().
1 parent d8dfcea commit 3718ae2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/test/txvalidationcache_tests.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ BOOST_FIXTURE_TEST_CASE(tx_mempool_block_doublespend, TestChain100Setup)
108108
// any script flag that is implemented as an upgraded NOP code.
109109
static void ValidateCheckInputsForAllFlags(const CTransaction &tx, uint32_t failing_flags, bool add_to_cache) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
110110
{
111-
PrecomputedTransactionData txdata(tx);
111+
PrecomputedTransactionData txdata;
112112
// If we add many more flags, this loop can get too expensive, but we can
113113
// rewrite in the future to randomly pick a set of flags to evaluate.
114114
for (uint32_t test_flags=0; test_flags < (1U << 16); test_flags += 1) {
@@ -200,7 +200,7 @@ BOOST_FIXTURE_TEST_CASE(checkinputs_test, TestChain100Setup)
200200
LOCK(cs_main);
201201

202202
TxValidationState state;
203-
PrecomputedTransactionData ptd_spend_tx(spend_tx);
203+
PrecomputedTransactionData ptd_spend_tx;
204204

205205
BOOST_CHECK(!CheckInputScripts(CTransaction(spend_tx), state, &::ChainstateActive().CoinsTip(), SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_DERSIG, true, true, ptd_spend_tx, nullptr));
206206

@@ -269,7 +269,7 @@ BOOST_FIXTURE_TEST_CASE(checkinputs_test, TestChain100Setup)
269269
// Make it valid, and check again
270270
invalid_with_cltv_tx.vin[0].scriptSig = CScript() << vchSig << 100;
271271
TxValidationState state;
272-
PrecomputedTransactionData txdata(invalid_with_cltv_tx);
272+
PrecomputedTransactionData txdata;
273273
BOOST_CHECK(CheckInputScripts(CTransaction(invalid_with_cltv_tx), state, ::ChainstateActive().CoinsTip(), SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY, true, true, txdata, nullptr));
274274
}
275275

@@ -297,7 +297,7 @@ BOOST_FIXTURE_TEST_CASE(checkinputs_test, TestChain100Setup)
297297
// Make it valid, and check again
298298
invalid_with_csv_tx.vin[0].scriptSig = CScript() << vchSig << 100;
299299
TxValidationState state;
300-
PrecomputedTransactionData txdata(invalid_with_csv_tx);
300+
PrecomputedTransactionData txdata;
301301
BOOST_CHECK(CheckInputScripts(CTransaction(invalid_with_csv_tx), state, &::ChainstateActive().CoinsTip(), SCRIPT_VERIFY_CHECKSEQUENCEVERIFY, true, true, txdata, nullptr));
302302
}
303303

@@ -358,7 +358,7 @@ BOOST_FIXTURE_TEST_CASE(checkinputs_test, TestChain100Setup)
358358
tx.vin[1].scriptWitness.SetNull();
359359

360360
TxValidationState state;
361-
PrecomputedTransactionData txdata(tx);
361+
PrecomputedTransactionData txdata;
362362
// This transaction is now invalid under segwit, because of the second input.
363363
BOOST_CHECK(!CheckInputScripts(CTransaction(tx), state, &::ChainstateActive().CoinsTip(), SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_WITNESS, true, true, txdata, nullptr));
364364

0 commit comments

Comments
 (0)