Skip to content

Commit dab207e

Browse files
committed
Preserve tx version=1 for certain tests
Without this change, the tests would be affected by default tx version increases.
1 parent c5d746a commit dab207e

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/test/hash_tests.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,11 @@ BOOST_AUTO_TEST_CASE(siphash)
124124
}
125125

126126
CHashWriter ss(SER_DISK, CLIENT_VERSION);
127-
ss << CTransaction();
127+
CMutableTransaction tx;
128+
// Note these tests were originally written with tx.nVersion=1
129+
// and the test would be affected by default tx version bumps if not fixed.
130+
tx.nVersion = 1;
131+
ss << tx;
128132
BOOST_CHECK_EQUAL(SipHashUint256(1, 2, ss.GetHash()), 0x79751e980c2a0a35ULL);
129133
}
130134

src/test/txvalidationcache_tests.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ BOOST_FIXTURE_TEST_CASE(tx_mempool_block_doublespend, TestChain100Setup)
3939
spends.resize(2);
4040
for (int i = 0; i < 2; i++)
4141
{
42+
spends[i].nVersion = 1;
4243
spends[i].vin.resize(1);
4344
spends[i].vin[0].prevout.hash = coinbaseTxns[0].GetHash();
4445
spends[i].vin[0].prevout.n = 0;

0 commit comments

Comments
 (0)