Browse Source

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).
pull/4/head
Mark Friedenbach 9 years ago
committed by Jack Grigg
parent
commit
fe53749dc9
No known key found for this signature in database GPG Key ID: 665DBCD284F7DAFF
  1. 1
      src/chainparams.cpp
  2. 1
      src/test/miner_tests.cpp

1
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<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));

1
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);

Loading…
Cancel
Save