this is specifically related to CUBE but I can see uses beyond this particular coin, i wasnt sure where to put such a question (
oops i meant to put this in development and technical discussion ).
currently CUBE can return negative stakes if coinage of staked coins is less than a certain value, just wondering how to build a client that would only try to stake inputs of a certain age.
it occurs to me that the simplest way would be modify the minimum stake age, the question is what format should the code be in to make this happen.
here is the code giving the negative stake
https://github.com/iGotSpots/DigiCube/blob/master/src/main.cpp#L995 if (nHeight > 1020000) {
nSubsidy = nVariableStakeRate * nCoinAge * 33 / (365 * 33 + 8);
nSquish = nSubsidy / 1000000;
if (nSquish > nMaxReward) {
nSubsidy = nMaxReward * COIN;
}
if (nCoinAge < nHeight * 2) {
nSubsidy = (nCoinAge - (nCoinAge * 1.25)) * COIN;
}
}
and STAKE_MIN_AGE is declared
https://github.com/iGotSpots/DigiCube/blob/master/src/main.h#L46static const int STAKE_MIN_AGE = 60 * 60 * 24;
seemingly then if you were to set the min age as, (60*60*24)+(nHeight*2) this would prevent the wallet from attempting to stake coins less than required age for positive stakes??
seems this is the line to change
https://github.com/iGotSpots/DigiCube/blob/master/src/main.cpp#L37unsigned int nStakeMinAge = STAKE_MIN_AGE;
to
int nStakeMinAge(int nStakeMinAge, int64 nCoinAge)
{
nPositiveStakeAge = nStakeMinAge + (nHeight * 2);
return nPositiveStakeAge;
}
??
note, by changing this particular variable seems the least intrusive way to do it.
also reducing the load of staking inputs.