diff --git a/src/miner.cpp b/src/miner.cpp index 25eb7eec4..d36ade59c 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -176,6 +176,8 @@ std::unique_ptr BlockAssembler::CreateNewBlock(const CScript& sc UpdateTime(pblock, chainparams.GetConsensus(), pindexPrev); pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, chainparams.GetConsensus()); pblock->nNonce = nHeight; // nNonce now holds the height for Cryptonight variant 4 + pblock->cnHeader.major_version = Params().GetConsensus().GetCryptonoteMajorVersion(); + pblock->cnHeader.prev_id = pblock->GetOriginalBlockHash(); pblocktemplate->vTxSigOpsCost[0] = WITNESS_SCALE_FACTOR * GetLegacySigOpCount(*pblock->vtx[0]); CValidationState state; diff --git a/test/functional/test_framework/blocktools.py b/test/functional/test_framework/blocktools.py index 3ef5ce928..860220973 100644 --- a/test/functional/test_framework/blocktools.py +++ b/test/functional/test_framework/blocktools.py @@ -42,7 +42,8 @@ def create_block(hashprev, coinbase, nTime=None): assert block.nNonce > 0 block.major_version = 10 # CN variant 4 block.timestamp = block.nTime - + # Give merkle root a random value. + block.merkle_root = uint256_from_str(bytes.fromhex("3cf6c3b6da3f4058853ee70369ee43d473aca91ae8fc8f44a645beb21c392d80")) block.calc_sha256() return block diff --git a/test/functional/test_framework/messages.py b/test/functional/test_framework/messages.py index a072682ee..faec0beb6 100644 --- a/test/functional/test_framework/messages.py +++ b/test/functional/test_framework/messages.py @@ -630,9 +630,6 @@ class CBlockHeader(): c += ser_uint256(self.prev_id) c += struct.pack("