@@ -1283,7 +1283,7 @@ bool GetSideStakingStatusAndAlloc(SideStakeAlloc& vSideStakeAlloc)
1283
1283
1284
1284
// This function parses the config file for the directives for stake splitting. It is used
1285
1285
// in StakeMiner for the miner loop and also called by rpc getmininginfo.
1286
- bool GetStakeSplitStatusAndParams (int64_t & nMinStakeSplitValue, double & dEfficiency)
1286
+ bool GetStakeSplitStatusAndParams (int64_t & nMinStakeSplitValue, double & dEfficiency, int64_t & nDesiredStakeOutputValue )
1287
1287
{
1288
1288
// Parse StakeSplit and SideStaking flags.
1289
1289
bool fEnableStakeSplit = GetBoolArg (" -enablestakesplit" );
@@ -1306,6 +1306,18 @@ bool GetStakeSplitStatusAndParams(int64_t& nMinStakeSplitValue, double& dEfficie
1306
1306
nMinStakeSplitValue = max (GetArg (" -minstakesplitvalue" , MIN_STAKE_SPLIT_VALUE_GRC), MIN_STAKE_SPLIT_VALUE_GRC) * COIN;
1307
1307
1308
1308
LogPrintf (" StakeMiner: nMinStakeSplitValue = %f" , CoinToDouble (nMinStakeSplitValue));
1309
+
1310
+ // For the definition of the constant G, please see
1311
+ // https://docs.google.com/document/d/1OyuTwdJx1Ax2YZ42WYkGn_UieN0uY13BTlA5G5IAN00/edit?usp=sharing
1312
+ // Refer to page 5 for G. This link is a draft of an upcoming bluepaper section.
1313
+ const double G = 9942.2056 ;
1314
+
1315
+ // Desired UTXO size post stake based on passed in efficiency and difficulty, but do not allow to go below
1316
+ // passed in MinStakeSplitValue. Note that we use GetAverageDifficulty over a 4 hour (160 block period) rather than
1317
+ // StakeKernelDiff, because the block to block difficulty has too much scatter. Please refer to the above link,
1318
+ // equation (27) on page 10 as a reference for the below formula.
1319
+ nDesiredStakeOutputValue = G * GetAverageDifficulty (160 ) * (3.0 / 2.0 ) * (1 / dEfficiency - 1 ) * COIN;
1320
+ nDesiredStakeOutputValue = max (nMinStakeSplitValue, nDesiredStakeOutputValue);
1309
1321
}
1310
1322
1311
1323
return fEnableStakeSplit ;
@@ -1328,25 +1340,6 @@ void StakeMiner(CWallet *pwallet)
1328
1340
// vSideStakeAlloc is an out parameter.
1329
1341
bool fEnableSideStaking = GetSideStakingStatusAndAlloc (vSideStakeAlloc);
1330
1342
1331
- // If stake output splitting is enabled, determine efficiency and minimum stake split value.
1332
- if (fEnableStakeSplit )
1333
- {
1334
- // Pull efficiency for UTXO staking from config, but constrain to the interval [0.75, 0.98]. Use default of 0.90.
1335
- dEfficiency = (double )GetArg (" -stakingefficiency" , 90 ) / 100 ;
1336
- if (dEfficiency > 0.98 )
1337
- dEfficiency = 0.98 ;
1338
- else if (dEfficiency < 0.75 )
1339
- dEfficiency = 0.75 ;
1340
-
1341
- LogPrintf (" StakeMiner: dEfficiency = %f" , dEfficiency);
1342
-
1343
- // Pull Minimum Post Stake UTXO Split Value from config or command line parameter.
1344
- // Default to 800 and do not allow it to be specified below 800 GRC.
1345
- nMinStakeSplitValue = max (GetArg (" -minstakesplitvalue" , MIN_STAKE_SPLIT_VALUE_GRC), MIN_STAKE_SPLIT_VALUE_GRC) * COIN;
1346
-
1347
- LogPrintf (" StakeMiner: nMinStakeSplitValue = %f" , CoinToDouble (nMinStakeSplitValue));
1348
- }
1349
-
1350
1343
supercfwd::fEnable = GetBoolArg (" -supercfwd" ,true );
1351
1344
if (fDebug ) LogPrintf (" supercfwd::fEnable= %d" ,supercfwd::fEnable );
1352
1345
0 commit comments