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

@@ -6,8 +6,8 @@
//
// These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR 2
#define CLIENT_VERSION_MINOR 1
#define CLIENT_VERSION_MAJOR 3
#define CLIENT_VERSION_MINOR 0
#define CLIENT_VERSION_REVISION 0
#define CLIENT_VERSION_BUILD 0
@@ -16,7 +16,7 @@
// Copyright year (2009-this)
// Todo: update this when changing our copyright comments in the source
#define COPYRIGHT_YEAR 2015
#define COPYRIGHT_YEAR 2016
// Converts the parameter X to a string after macro replacement on X has been performed.
// Don't merge these into one macro!

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);

View File

@@ -29,13 +29,13 @@ static const std::string COIN_NAME_DISPLAY("CasinoCoin");
// network protocol versioning
//
static const int PROTOCOL_VERSION = 70004;
static const int PROTOCOL_VERSION = 80001;
// intial proto version, to be increased after version/verack negotiation
static const int INIT_PROTO_VERSION = 209;
// disconnect from peers older than this proto version
static const int MIN_PEER_PROTO_VERSION = 70004; // TODO: Change to 70004 before block 445000 to force new client downloading and therefore doing the actual hard fork
static const int MIN_PEER_PROTO_VERSION = 80001; // TODO: Change to 70004 before block 445000 to force new client downloading and therefore doing the actual hard fork
// nTime field added to CAddress, starting with this version;
// if possible, avoid requesting addresses nodes older than this