Browse Source

Fixed unit test cases after change of hash calculation.

cn_mining
Jianping Wu 6 years ago
parent
commit
33ed36e5bf
  1. 4
      src/test/blockencodings_tests.cpp
  2. 2
      src/test/test_bitcoin.cpp
  3. 3
      src/test/validation_block_tests.cpp

4
src/test/blockencodings_tests.cpp

@ -48,7 +48,7 @@ static CBlock BuildBlockTestCase() { @@ -48,7 +48,7 @@ static CBlock BuildBlockTestCase() {
block.hashMerkleRoot = BlockMerkleRoot(block, &mutated);
assert(!mutated);
block.cnHeader.major_version = Params().GetConsensus().GetCryptonoteMajorVersion();
block.cnHeader.prev_id = block.GetHash();
block.cnHeader.prev_id = block.GetOriginalBlockHash();
while (!CheckProofOfWork(block.GetPoWHash(), block.nBits, Params().GetConsensus())) ++block.cnHeader.nonce;
return block;
}
@ -295,7 +295,7 @@ BOOST_AUTO_TEST_CASE(EmptyBlockRoundTripTest) @@ -295,7 +295,7 @@ BOOST_AUTO_TEST_CASE(EmptyBlockRoundTripTest)
block.hashMerkleRoot = BlockMerkleRoot(block, &mutated);
assert(!mutated);
block.cnHeader.major_version = Params().GetConsensus().GetCryptonoteMajorVersion();
block.cnHeader.prev_id = block.GetHash();
block.cnHeader.prev_id = block.GetOriginalHash();
while (!CheckProofOfWork(block.GetPoWHash(), block.nBits, Params().GetConsensus())) ++block.cnHeader.nonce;
// Test simple header round-trip with only coinbase

2
src/test/test_bitcoin.cpp

@ -155,7 +155,7 @@ TestChain100Setup::CreateAndProcessBlock(const std::vector<CMutableTransaction>& @@ -155,7 +155,7 @@ TestChain100Setup::CreateAndProcessBlock(const std::vector<CMutableTransaction>&
}
block.cnHeader.major_version = Params().GetConsensus().GetCryptonoteMajorVersion();
block.cnHeader.prev_id = block.GetHash();
block.cnHeader.prev_id = block.GetOriginalBlockHash();
while (!CheckProofOfWork(block.GetPoWHash(), block.nBits, chainparams.GetConsensus())) ++block.cnHeader.nonce;
std::shared_ptr<const CBlock> shared_pblock = std::make_shared<const CBlock>(block);

3
src/test/validation_block_tests.cpp

@ -75,11 +75,10 @@ std::shared_ptr<CBlock> FinalizeBlock(std::shared_ptr<CBlock> pblock) @@ -75,11 +75,10 @@ std::shared_ptr<CBlock> FinalizeBlock(std::shared_ptr<CBlock> pblock)
pblock->hashMerkleRoot = BlockMerkleRoot(*pblock);
pblock->cnHeader.major_version = Params().GetConsensus().GetCryptonoteMajorVersion();
pblock->cnHeader.prev_id = pblock->GetHash();
pblock->cnHeader.prev_id = pblock->GetOriginalBlockHash();
while (!CheckProofOfWork(pblock->GetPoWHash(), pblock->nBits, Params().GetConsensus())) {
++(pblock->cnHeader.nonce);
}
return pblock;
}

Loading…
Cancel
Save