From fc42abccf7c906241f4c9b610df6cf450b974c7f Mon Sep 17 00:00:00 2001 From: thekidcoin Date: Sat, 8 Mar 2014 15:51:40 -0600 Subject: [PATCH] v0.4.5.0 fixes --- src/checkpoints.cpp | 1 + src/checkpoints.h | 2 +- src/clientversion.h | 2 +- src/kernel.cpp | 1 + src/main.cpp | 53 +++++++++++++++++++++++++-------------------- src/main.h | 5 ++--- src/version.h | 6 ++--- 7 files changed, 39 insertions(+), 31 deletions(-) diff --git a/src/checkpoints.cpp b/src/checkpoints.cpp index 16e7880..12887b5 100644 --- a/src/checkpoints.cpp +++ b/src/checkpoints.cpp @@ -25,6 +25,7 @@ namespace Checkpoints static MapCheckpoints mapCheckpoints = boost::assign::map_list_of ( 0, std::make_pair(hashGenesisBlock, 1393864140) ) + ( 5454, std::make_pair("0x0000000034f15d3e1a1a57adbb160e8bf363e198504ba0093972561bbfa4338d", 1394303940) ) ; // TestNet has no checkpoints diff --git a/src/checkpoints.h b/src/checkpoints.h index 0e1939f..68737a6 100644 --- a/src/checkpoints.h +++ b/src/checkpoints.h @@ -8,7 +8,7 @@ #include "net.h" #include "util.h" -#define CHECKPOINT_MAX_SPAN (60 * 60) // max 1 hour before latest block +#define CHECKPOINT_MAX_SPAN (60) // max 1 hour before latest block #ifdef WIN32 #undef STRICT diff --git a/src/clientversion.h b/src/clientversion.h index 4a8f13f..3af7a87 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -9,7 +9,7 @@ #define CLIENT_VERSION_MAJOR 0 #define CLIENT_VERSION_MINOR 7 #define CLIENT_VERSION_REVISION 5 -#define CLIENT_VERSION_BUILD 5 +#define CLIENT_VERSION_BUILD 6 // Converts the parameter X to a string after macro replacement on X has been performed. // Don't merge these into one macro! diff --git a/src/kernel.cpp b/src/kernel.cpp index ddd285e..0c7546e 100644 --- a/src/kernel.cpp +++ b/src/kernel.cpp @@ -20,6 +20,7 @@ static std::map mapStakeModifierCheckpoints = ( 0, 0xfd11f4e7u ) ( 1600, 0xf9007bccu ) ( 3200, 0xbd7e3fb6u ) + ( 5454, 0x4fa51317u ) ; // Hard checkpoints of stake modifiers to ensure they are deterministic (testNet) diff --git a/src/main.cpp b/src/main.cpp index 26ce849..95c974a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -777,12 +777,9 @@ int CMerkleTx::GetBlocksToMaturity() const if (!(IsCoinBase() || IsCoinStake())) return 0; - //if (pindexBest->nHeight > 3295) - //{ - return max(0, (nCoinbaseMaturity+100) - GetDepthInMainChain()); // increase maturity of mined blocks - //} - //else - //return max(0, (nCoinbaseMaturity+20) - GetDepthInMainChain()); + + return max(0, (nCoinbaseMaturity+100) - GetDepthInMainChain()); // increase maturity of mined blocks + } @@ -1071,9 +1068,9 @@ unsigned int ComputeMaxBits(CBigNum bnTargetLimit, unsigned int nBase, int64 nTi while (nTime > 0 && bnResult < bnTargetLimit) { - // Maximum 200% adjustment per day... + // Maximum 200% adjustment per 4 hours bnResult *= 2; - nTime -= 24 * 60 * 60; + nTime -= 4 * 60 * 60; } if (bnResult > bnTargetLimit) bnResult = bnTargetLimit; @@ -1825,7 +1822,7 @@ bool CBlock::ConnectBlock(CTxDB& txdb, CBlockIndex* pindex, bool fJustCheck) // Check coinbase reward if (vtx[0].GetValueOut() > nReward) - return DoS(50, error("CheckBlock() : coinbase reward exceeded (actual=%"PRI64d" vs calculated=%"PRI64d") at Height=%d", vtx[0].GetValueOut(), nReward, pindex->pprev->nHeight+1)); + return DoS(50, error("ConnectBlock() : coinbase reward exceeded (actual=%"PRI64d" vs calculated=%"PRI64d") at Height=%d", vtx[0].GetValueOut(), nReward, pindex->pprev->nHeight+1)); if (!pindex->IsProofOfStake() && !pindex->pprev->IsProofOfStake()) { @@ -2306,22 +2303,13 @@ bool CBlock::CheckBlock(bool fCheckPOW, bool fCheckMerkleRoot, bool fCheckSig) c return DoS(100, error("CheckBlock() : bad proof-of-stake block signature")); } -/* - // Should we check proof-of-work block signature or not? - // - // * Always skip on TestNet - // * Perform checking for the first 25,000 blocks - // * Perform checking since last checkpoint - - if(!fTestNet && fCheckSig) + else { - bool checkEntropySig = (GetBlockTime() < ENTROPY_SWITCH_TIME); - - // FlutterCoin: check proof-of-work block signature - if (checkEntropySig && !CheckBlockSignature(false)) - return DoS(100, error("CheckBlock() : bad proof-of-work block signature")); + // Check coinbase reward is not 0 + if (vtx[0].GetValueOut() == 0 && GetHash() != hashGenesisBlock) + return DoS(50, error("CheckBlock() : 0 value block bad chain (actual=%"PRI64d")", vtx[0].GetValueOut())); } -*/ + // Check transactions BOOST_FOREACH(const CTransaction& tx, vtx) @@ -3236,6 +3224,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) CAddress addrMe; CAddress addrFrom; uint64 nNonce = 1; + bool badVersion = false; vRecv >> pfrom->nVersion >> pfrom->nServices >> nTime >> addrMe; if (pfrom->nVersion < MIN_PROTO_VERSION) { @@ -3246,6 +3235,24 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) return false; } + if(nTime < 1394409600) // Mon, 10 Mar 2014 00:00:00 GMT + { + if(pfrom->nVersion < 70002) + badVersion = true; + } + else + { + if(pfrom->nVersion < 70003) + badVersion = true; + } + + if(badVersion) + { + printf("partner %s using obsolete version %i; disconnecting\n", pfrom->addr.ToString().c_str(), pfrom->nVersion); + pfrom->fDisconnect = true; + return false; + } + if (pfrom->nVersion == 10300) pfrom->nVersion = 300; if (!vRecv.empty()) diff --git a/src/main.h b/src/main.h index bd648d6..230137a 100644 --- a/src/main.h +++ b/src/main.h @@ -35,11 +35,10 @@ static const unsigned int MAX_INV_SZ = 50000; static const int64 MIN_TX_FEE = CENT; static const int64 MIN_RELAY_TX_FEE = CENT; static const int64 MAX_MONEY = 50000000000LL * COIN; -static const int64 MAX_MINT_PROOF_OF_WORK = 5000 * COIN; +static const int64 MAX_MINT_PROOF_OF_WORK = 10000 * COIN; static const int64 MAX_MINT_PROOF_OF_STAKE = 1 * COIN; static const int64 MIN_TXOUT_AMOUNT = MIN_TX_FEE; static const unsigned int ENTROPY_SWITCH_TIME = 1420070399; // Dec 31 2014, 23:59:59 PM GMT -static const unsigned int STAKE_SWITCH_TIME = 1394193600; // March 7 12:00:00 GMT string SearchTerm(const char *chAddress); bool fAddrMiner (const char *chHash, const char *chTerm); @@ -588,7 +587,7 @@ class CTransaction { // Large (in bytes) low-priority (new, small-coin) transactions // need a fee. - return dPriority > COIN * 1440 / 250; + return dPriority > COIN * 720 / 250; } int64 GetMinFee(unsigned int nBlockSize=1, bool fAllowFree=false, enum GetMinFee_mode mode=GMF_BLOCK, unsigned int nBytes = 0) const; diff --git a/src/version.h b/src/version.h index 3081ba2..cfe39c9 100644 --- a/src/version.h +++ b/src/version.h @@ -30,7 +30,7 @@ static const int DATABASE_VERSION = 70507; // network protocol versioning // -static const int PROTOCOL_VERSION = 70002; +static const int PROTOCOL_VERSION = 70003; // earlier versions not supported as of Feb 2012, and are disconnected static const int MIN_PROTO_VERSION = 70002; @@ -51,7 +51,7 @@ static const int MEMPOOL_GD_VERSION = 70000; #define DISPLAY_VERSION_MAJOR 0 #define DISPLAY_VERSION_MINOR 4 -#define DISPLAY_VERSION_REVISION 4 -#define DISPLAY_VERSION_BUILD 9 +#define DISPLAY_VERSION_REVISION 5 +#define DISPLAY_VERSION_BUILD 0 #endif