From fe53749dc93bc0365acea9209a68b4f788d965d6 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 23544f488..39ad31c5f 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -75,6 +75,7 @@ public: */ const char* pszTimestamp = "Zcash0b9c4eef8b7cc417ee5001e3500984b6fea35683a7cac141a043c42064835d34"; CMutableTransaction txNew; + txNew.nVersion = 1; txNew.vin.resize(1); txNew.vout.resize(1); txNew.vin[0].scriptSig = CScript() << 520617983 << 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 0db80ec3e..0ef66f6c7 100644 --- a/src/test/miner_tests.cpp +++ b/src/test/miner_tests.cpp @@ -165,6 +165,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity) // will be closer to the tip, and blocks will appear slower. pblock->nTime = chainActive.Tip()->GetMedianTimePast()+6*Params().GetConsensus().nPowTargetSpacing; CMutableTransaction txCoinbase(pblock->vtx[0]); + txCoinbase.nVersion = 1; txCoinbase.vin[0].scriptSig = CScript() << (chainActive.Height()+1) << OP_0; txCoinbase.vout[0].scriptPubKey = CScript(); pblock->vtx[0] = CTransaction(txCoinbase);