Skip to content

Commit

Permalink
Fix logic to require mandatory sidestaking in miner.cpp
Browse files Browse the repository at this point in the history
If mandatory sidestakes that have non-zero allocation are set OR
local sidestakes with non-zero allocations are set and the
-enablesidestaking flag is turned on, then set
fEnableSideStaking in the miner to true to include sidestakes.

This replaces the old logic of fEnableSideStaking, which simply
followed -enablestidestaking.
  • Loading branch information
jamescowens committed Dec 28, 2023
1 parent c990484 commit e7c3f27
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1334,12 +1334,15 @@ void StakeMiner(CWallet *pwallet)
// nMinStakeSplitValue and dEfficiency are out parameters.
bool fEnableStakeSplit = GetStakeSplitStatusAndParams(nMinStakeSplitValue, dEfficiency, nDesiredStakeOutputValue);

bool fEnableSideStaking = gArgs.GetBoolArg("-enablesidestaking");

// Note that fEnableSideStaking is now processed internal to ActiveSideStakeEntries. The sidestaking flag only
// controls local sidestakes. If there exists mandatory sidestakes, they occur regardless of the flag.
vSideStakeAlloc = GRC::GetSideStakeRegistry().ActiveSideStakeEntries(false, false);

// If the vSideStakeAlloc is not empty, then set fEnableSideStaking to true. Note that vSideStakeAlloc will not be empty
// if non-zero allocation mandatory sidestakes are set OR local sidestaking is turned on by the -enablesidestaking config
// option.
bool fEnableSideStaking = (!vSideStakeAlloc.empty());

// wait for next round
if (!MilliSleep(nMinerSleep)) return;

Expand Down

0 comments on commit e7c3f27

Please sign in to comment.