Skip to content

Commit

Permalink
Update test case to use blockHeight from tip instead of deprecatedHei…
Browse files Browse the repository at this point in the history
…ght (#1204)
  • Loading branch information
shohamc1 authored Apr 27, 2022
1 parent ef95289 commit 43158cd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/test/blockencodings_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ static CBlock BuildBlockTestCase() {
uint256 masternodeID = testMasternodeKeys.begin()->first;
uint32_t mintedBlocks(0);
int64_t creationHeight;
int64_t blockHeight;
CKey minterKey;
std::map<uint256, TestMasternodeKeys>::const_iterator pos = testMasternodeKeys.find(masternodeID);
if (pos == testMasternodeKeys.end())
Expand All @@ -60,6 +61,7 @@ static CBlock BuildBlockTestCase() {
creationHeight = int64_t(nodePtr->creationHeight);
}

blockHeight = tip->nHeight + 1;
block.deprecatedHeight = tip->nHeight + 1;
block.mintedBlocks = mintedBlocks + 1;
block.stakeModifier = pos::ComputeStakeModifier(tip->stakeModifier, minterKey.GetPubKey().GetID());
Expand All @@ -81,7 +83,7 @@ static CBlock BuildBlockTestCase() {
block.nTime = 0;
CheckContextState ctxState;

while (!pos::CheckKernelHash(block.stakeModifier, block.nBits, creationHeight, (int64_t) block.nTime, block.deprecatedHeight, masternodeID, Params().GetConsensus(), {0, 0, 0, 0}, 0, ctxState)) block.nTime++;
while (!pos::CheckKernelHash(block.stakeModifier, block.nBits, creationHeight, (int64_t) block.nTime, blockHeight, masternodeID, Params().GetConsensus(), {0, 0, 0, 0}, 0, ctxState)) block.nTime++;

std::shared_ptr<CBlock> pblock = std::make_shared<CBlock>(std::move(block));
auto err = pos::SignPosBlock(pblock, minterKey);
Expand Down

0 comments on commit 43158cd

Please sign in to comment.