Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update test cases to remove deprecatedHeight usage. #1204

Merged
merged 1 commit into from
Apr 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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