Skip to content

Commit

Permalink
Implement GetMinimumConnectionsRequiredForStaking
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescowens committed Apr 11, 2021
1 parent a485ecd commit 6b2467d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
5 changes: 5 additions & 0 deletions src/chainparams.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,8 @@ inline int GetNewbieSnapshotFixHeight()
{
return fTestNet ? 1480000 : 2197000;
}

inline unsigned int GetMinimumConnectionsRequiredForStaking()
{
return fTestNet ? 1 : 3;
}
10 changes: 4 additions & 6 deletions src/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1156,23 +1156,21 @@ bool IsMiningAllowed(CWallet *pwallet)
{
LOCK(g_miner_status.lock);
g_miner_status.SetReasonNotStaking(GRC::MinerStatus::WALLET_LOCKED);
status=false;
status = false;
}

if(fDevbuildCripple)
{
LOCK(g_miner_status.lock);
g_miner_status.SetReasonNotStaking(GRC::MinerStatus::TESTNET_ONLY);
status=false;
status = false;
}

if (vNodes.empty() || (!fTestNet&& IsInitialBlockDownload()) ||
(!fTestNet&& vNodes.size() < 3)
)
if (vNodes.size() < GetMinimumConnectionsRequiredForStaking() || (!fTestNet && IsInitialBlockDownload()))
{
LOCK(g_miner_status.lock);
g_miner_status.SetReasonNotStaking(GRC::MinerStatus::OFFLINE);
status=false;
status = false;
}

return status;
Expand Down

0 comments on commit 6b2467d

Please sign in to comment.