Skip to content

Commit

Permalink
v0.4.5.0 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
thekidcoin committed Mar 8, 2014
1 parent fa3e9a3 commit fc42abc
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 31 deletions.
1 change: 1 addition & 0 deletions src/checkpoints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/checkpoints.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/clientversion.h
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down
1 change: 1 addition & 0 deletions src/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ static std::map<int, unsigned int> mapStakeModifierCheckpoints =
( 0, 0xfd11f4e7u )
( 1600, 0xf9007bccu )
( 3200, 0xbd7e3fb6u )
( 5454, 0x4fa51317u )
;

// Hard checkpoints of stake modifiers to ensure they are deterministic (testNet)
Expand Down
53 changes: 30 additions & 23 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

}


Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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())
{
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
{
Expand All @@ -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())
Expand Down
5 changes: 2 additions & 3 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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

0 comments on commit fc42abc

Please sign in to comment.