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).
This commit is contained in:
Mark Friedenbach 2015-06-02 16:25:34 -07:00 committed by Jack Grigg
parent 38246ea461
commit fe53749dc9
No known key found for this signature in database
GPG Key ID: 665DBCD284F7DAFF
2 changed files with 2 additions and 0 deletions

View File

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

View File

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