From 4d5f4e2d4d7bec8a49ba70ed7a336c5c4f3fc050 Mon Sep 17 00:00:00 2001 From: Mark Friedenbach Date: Tue, 2 Jun 2015 16:25:34 -0700 Subject: [PATCH] Explicitly set tx.nVersion for the genesis block and mining tests If/when CTransaction::CURRENT_VERSION is incremented, this will break CChainParams and the miner tests. This fix sets the transaction version explicitly where we depend on the hash value (genesis block, proof of work checks). --- src/chainparams.cpp | 1 + src/test/miner_tests.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index ffcbaceb0a..651899e542 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -135,6 +135,7 @@ public: */ const char* pszTimestamp = "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks"; CMutableTransaction txNew; + txNew.nVersion = 1; txNew.vin.resize(1); txNew.vout.resize(1); txNew.vin[0].scriptSig = CScript() << 486604799 << CScriptNum(4) << vector((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp)); diff --git a/src/test/miner_tests.cpp b/src/test/miner_tests.cpp index 53c2e7b261..01895a9e68 100644 --- a/src/test/miner_tests.cpp +++ b/src/test/miner_tests.cpp @@ -71,6 +71,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity) pblock->nVersion = 1; pblock->nTime = chainActive.Tip()->GetMedianTimePast()+1; CMutableTransaction txCoinbase(pblock->vtx[0]); + txCoinbase.nVersion = 1; txCoinbase.vin[0].scriptSig = CScript(); txCoinbase.vin[0].scriptSig.push_back(blockinfo[i].extranonce); txCoinbase.vin[0].scriptSig.push_back(chainActive.Height());