Does luckycoin actually do this? I don't see how you can possibly use a rand function in GetBlockValue... it would essentially make block rewards unverifiable at up to the miner to choose (and the miner would obviously always choose to pay himself the largest possible value). My glance at the luckycoin source doesn't show any randomness as part of the GetBlockValue function. Simply put, GetBlockValue MUST return a verifiable and repeatable value, or else you are breaking the entire system.
@phzi it appears that it does use a random assigned int to discern the payout..
int static generateMTRandom(unsigned int s, int range)
{
random::mt19937 gen(s);
random::uniform_int_distribution<> dist(1, range);
return dist(gen);
}
int64 static GetBlockValue(int nHeight, int64 nFees, uint256 prevHash)
{
int64 nSubsidy = 88 * COIN;
if(nHeight < 50000)
{
const char* cseed = prevHash.ToString().substr(8,7).c_str();
long seed = hex2long(cseed);
int rand = generateMTRandom(seed, 100000);
if(rand > 30000 && rand < 35001)
nSubsidy = 188 * COIN;
else if(rand > 70000 && rand < 71001)
nSubsidy = 588 * COIN;
else if(rand > 50000 && rand < 50011)
nSubsidy = 5888 * COIN;
}
else
{
// Subsidy is cut in half every 1,036,800 blocks, which will occur approximately every 2 years
nSubsidy >>= (nHeight / 1036800); // Luckycoin: 1036.8K blocks in ~2 years
const char* cseed = prevHash.ToString().substr(8,7).c_str();
long seed = hex2long(cseed);
int rand = generateMTRandom(seed, 100000);
if(rand > 30000 && rand < 35001)
nSubsidy *= 2;
else if(rand > 70000 && rand < 71001)
nSubsidy *= 5;
else if(rand > 50000 && rand < 50011)
nSubsidy *= 58;
}
return nSubsidy + nFees;
}