ERROR: ConnectBlock() : coinbase pays too much (actual=20000000 vs limit=20000000)
I got this error at my debug.log
anyone know how to fix this issue? I am coding a new coin, changing its rewards, which parametter I need change to increase the limit.
on the line:
if (vtx[0].GetValueOut() > GetBlockValue(pindex->nHeight, nFees, pindex->nBits))
return state.DoS(100, error("ConnectBlock() : coinbase pays too much (actual=%"PRI64d" vs limit=%"PRI64d")", vtx[0].GetV$
I changed my nsubsidy for the code
int getrandint(int min, int max)
{
int num;
num=rand();
num=num%(max-min+1)+min;
return num;
}
int64 static GetBlockValue(int nHeight, int64 nFees, unsigned int nBits)
{
if (nHeight == 0)
{
return nGenesisBlockRewardCoin;
}
unsigned int i, iMax, iMin;
iMin = 1;
iMax = 50;
if(nHeight<500)
{
iMax = 3;
}
if(nHeight > 8000)
{
iMax = 30;
}
if(nHeight > 20000)
{
iMax = 20;
}
if(nHeight > 100000)
{
iMax = 10;
}
i = getrandint(iMin, iMax);
int64 nSubsidy = nBlockRewardStartCoin * i ;
// Subsidy is cut in half every 60480 blocks (21 days)
//nSubsidy >>= (nHeight / 60480);
// Minimum subsidy
if (nSubsidy < nBlockRewardMinimumCoin)
{
nSubsidy = nBlockRewardMinimumCoin;
}
return nSubsidy + nFees;
}
The code originally was
int64 static GetBlockValue(int nHeight, int64 nFees, unsigned int nBits)
{
if (nHeight == 0)
{
return nGenesisBlockRewardCoin;
}
int64 nSubsidy = nBlockRewardStartCoin;
// Subsidy is cut in half every 60480 blocks (21 days)
nSubsidy >>= (nHeight / 60480);
// Minimum subsidy
if (nSubsidy < nBlockRewardMinimumCoin)
{
nSubsidy = nBlockRewardMinimumCoin;
}
return nSubsidy + nFees;
}
Because of what I change, my code give the error coinbase pays too much
root@eatSushi1:~/dogequark/src$ ./dogequarkd
dogequark server starting
root@eatSushi1:~/dogequark/src$ terminate called after throwing an instance of 'std::runtime_error'
what(): CreateNewBlock() : ConnectBlock failed
I also got this error when I run the coind at another server after cloning through github.
nSubsidy
for the reason JoelKatz explained. – Nik Bougalis Mar 4 '14 at 11:02