From dab207e4e694c6980336f59817d6c9af83a46fa2 Mon Sep 17 00:00:00 2001 From: BtcDrak Date: Wed, 7 Dec 2016 20:22:07 +0000 Subject: [PATCH] Preserve tx version=1 for certain tests Without this change, the tests would be affected by default tx version increases. --- src/test/hash_tests.cpp | 6 +++++- src/test/txvalidationcache_tests.cpp | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/test/hash_tests.cpp b/src/test/hash_tests.cpp index fa9624f13..8be9c580c 100644 --- a/src/test/hash_tests.cpp +++ b/src/test/hash_tests.cpp @@ -124,7 +124,11 @@ BOOST_AUTO_TEST_CASE(siphash) } CHashWriter ss(SER_DISK, CLIENT_VERSION); - ss << CTransaction(); + CMutableTransaction tx; + // Note these tests were originally written with tx.nVersion=1 + // and the test would be affected by default tx version bumps if not fixed. + tx.nVersion = 1; + ss << tx; BOOST_CHECK_EQUAL(SipHashUint256(1, 2, ss.GetHash()), 0x79751e980c2a0a35ULL); } diff --git a/src/test/txvalidationcache_tests.cpp b/src/test/txvalidationcache_tests.cpp index 55b4d28fb..9f58f004d 100644 --- a/src/test/txvalidationcache_tests.cpp +++ b/src/test/txvalidationcache_tests.cpp @@ -39,6 +39,7 @@ BOOST_FIXTURE_TEST_CASE(tx_mempool_block_doublespend, TestChain100Setup) spends.resize(2); for (int i = 0; i < 2; i++) { + spends[i].nVersion = 1; spends[i].vin.resize(1); spends[i].vin[0].prevout.hash = coinbaseTxns[0].GetHash(); spends[i].vin[0].prevout.n = 0;