Skip to content

Commit 3eca8da

Browse files
committed
[Core][Tests] REGTEST: fix nStakeModifier=0
1 parent 01fe200 commit 3eca8da

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/kernel.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,11 @@ bool ComputeNextStakeModifier(const CBlockIndex* pindexPrev, uint64_t& nStakeMod
147147
{
148148
nStakeModifier = 0;
149149
fGeneratedStakeModifier = false;
150+
151+
// modifier 0 on RegTest
152+
if (Params().NetworkID() == CBaseChainParams::REGTEST) {
153+
return true;
154+
}
150155
if (!pindexPrev) {
151156
fGeneratedStakeModifier = true;
152157
return true; // genesis block's modifier is 0
@@ -240,6 +245,10 @@ bool ComputeNextStakeModifier(const CBlockIndex* pindexPrev, uint64_t& nStakeMod
240245
bool GetKernelStakeModifier(uint256 hashBlockFrom, uint64_t& nStakeModifier, int& nStakeModifierHeight, int64_t& nStakeModifierTime, bool fPrintProofOfStake)
241246
{
242247
nStakeModifier = 0;
248+
// modifier 0 on RegTest
249+
if (Params().NetworkID() == CBaseChainParams::REGTEST) {
250+
return true;
251+
}
243252
if (!mapBlockIndex.count(hashBlockFrom))
244253
return error("%s : block not indexed", __func__);
245254
const CBlockIndex* pindexFrom = mapBlockIndex[hashBlockFrom];

0 commit comments

Comments
 (0)