Skip to content

Commit efd4444

Browse files
committed
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).
1 parent f00b623 commit efd4444

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/chainparams.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class CMainParams : public CChainParams {
6666
*/
6767
const char* pszTimestamp = "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks";
6868
CMutableTransaction txNew;
69+
txNew.nVersion = 1;
6970
txNew.vin.resize(1);
7071
txNew.vout.resize(1);
7172
txNew.vin[0].scriptSig = CScript() << 486604799 << CScriptNum(4) << vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));

src/test/miner_tests.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
7474
pblock->nVersion = 1;
7575
pblock->nTime = chainActive.Tip()->GetMedianTimePast()+1;
7676
CMutableTransaction txCoinbase(pblock->vtx[0]);
77+
txCoinbase.nVersion = 1;
7778
txCoinbase.vin[0].scriptSig = CScript();
7879
txCoinbase.vin[0].scriptSig.push_back(blockinfo[i].extranonce);
7980
txCoinbase.vin[0].scriptSig.push_back(chainActive.Height());

0 commit comments

Comments
 (0)