Reduced coin reward and version update

This commit is contained in:
Andre Jochems
2016-06-02 14:05:57 +02:00
parent 8906eb0445
commit 1a5784fa8b
5 changed files with 111 additions and 31 deletions

View File

@@ -1109,18 +1109,24 @@ int64 static GetBlockValue(int nHeight, int64 nFees)
}
// Permantently reduce the number of mined coins to 10 after block 575000
// Permantently reduce the number of minded coins to 1 after block 1750000
// coin supply at that height = 40327215
// Blocks until max coin supply -> 63000000 - 40327215 = 22672785
// New height for reduction to 0 coins -> 1750000 + 22672785 = 24422785
if(nHeight > 575000){
if(nHeight < 3756000){
nSubsidy = 10 * COIN;
if(nHeight < 1750000)
{
nSubsidy = 10 * COIN;
}
else if(nHeight >= 1750000 && nHeight <= 24422785){
nSubsidy = 1 * COIN;
}
else
{
nSubsidy = 0 * COIN;
}
}
// return subsidy + fees
return nSubsidy + nFees;
}
@@ -3494,6 +3500,26 @@ void static ProcessGetData(CNode* pfrom)
}
}
bool static CheckValidClientVersion(int clientVersion)
{
// From block 1750000 onwards version must be 80001 (MIN_PEER_PROTO_VERSION)
// Before that version was 70004
if(pindexBest->nHeight >= 1750000)
{
if(clientVersion < MIN_PEER_PROTO_VERSION)
return false;
else
return true;
}
else
{
if(clientVersion < 70004)
return false;
else
return true;
}
}
bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
{
RandAddSeedPerfmon();
@@ -3505,10 +3531,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
return true;
}
if (strCommand == "version")
{
// Each connection can only send one version message
@@ -3523,7 +3545,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
CAddress addrFrom;
uint64 nNonce = 1;
vRecv >> pfrom->nVersion >> pfrom->nServices >> nTime >> addrMe;
if (pfrom->nVersion < MIN_PEER_PROTO_VERSION)
// Check version related to blockheight
if(!CheckValidClientVersion(pfrom->nVersion))
{
// disconnect from peers older than this proto version
printf("partner %s using obsolete version %i; disconnecting\n", pfrom->addr.ToString().c_str(), pfrom->nVersion);