From 2c37da26ee5dde9e7c41d7f891a36e3081dc1e66 Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 1 Jan 2014 05:51:32 +0400 Subject: [PATCH] Bump version to 0.4.4.6 Changes list: * Add checkpoints; * Remove stake weight switch code; * Remove output limit for testnet since publishing / for mainnet since 1 May 2014; * Remove mandatory fee for testnet since publishing / for mainnet since 1 may 2014. --- src/checkpoints.cpp | 1 + src/clientversion.h | 2 +- src/kernel.cpp | 35 ++++++++++------------------------- src/main.cpp | 14 +++++++------- src/main.h | 2 +- src/version.h | 4 ++-- src/wallet.cpp | 12 ++---------- 7 files changed, 24 insertions(+), 46 deletions(-) diff --git a/src/checkpoints.cpp b/src/checkpoints.cpp index aeb1d92..f9c3c2e 100644 --- a/src/checkpoints.cpp +++ b/src/checkpoints.cpp @@ -44,6 +44,7 @@ namespace Checkpoints ( 13560, initCheckpoint(uint256("0xa1591a0fcbf11f282d671581edb9f0aadcd06fee69761081e0a3245914c13729"), 1364674052) ) ( 37092, initCheckpoint(uint256("0x0000000000a38c2f98556f46793b453e92d8fab2d31c0b93fd08bcf78e56099d"), 1376677203) ) ( 44200, initCheckpoint(uint256("0xc9bda7232a18b9c1f5ff974a9e5566b2d1879ceb8fc0e9e61fba9038a25b8447"), 1380145962) ) + ( 65000, initCheckpoint(uint256("0xfb2b51a2fd65062c98a7a6053cde46aeaefebb95ba2f680e85a29ee25b1dcf05"), 1388526385) ) ; // TestNet has no checkpoints diff --git a/src/clientversion.h b/src/clientversion.h index 79da7b1..4a8f13f 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 3 +#define CLIENT_VERSION_BUILD 5 // 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 4b03c7f..959bd10 100644 --- a/src/kernel.cpp +++ b/src/kernel.cpp @@ -22,6 +22,7 @@ static std::map mapStakeModifierCheckpoints = ( 12661, 0x5d84115du ) ( 37092, 0xd230afccu ) ( 44200, 0x05370164u ) + ( 65000, 0xc8e7be6au ) ; // Hard checkpoints of stake modifiers to ensure they are deterministic (testNet) @@ -63,11 +64,8 @@ static int64 GetStakeModifierSelectionInterval() // select a block from the candidate blocks in vSortedByTimestamp, excluding // already selected blocks in vSelectedBlocks, and with timestamp up to // nSelectionIntervalStop. -static bool SelectBlockFromCandidates( - vector >& vSortedByTimestamp, - map& mapSelectedBlocks, - int64 nSelectionIntervalStop, uint64 nStakeModifierPrev, - const CBlockIndex** pindexSelected) +static bool SelectBlockFromCandidates(vector >& vSortedByTimestamp, map& mapSelectedBlocks, + int64 nSelectionIntervalStop, uint64 nStakeModifierPrev, const CBlockIndex** pindexSelected) { bool fSelected = false; uint256 hashBest = 0; @@ -174,8 +172,7 @@ bool ComputeNextStakeModifier(const CBlockIndex* pindexPrev, uint64& nStakeModif // add the selected block from candidates to selected list mapSelectedBlocks.insert(make_pair(pindex->GetBlockHash(), pindex)); if (fDebug && GetBoolArg("-printstakemodifier")) - printf("ComputeNextStakeModifier: selected round %d stop=%s height=%d bit=%d\n", - nRound, DateTimeStrFormat(nSelectionIntervalStop).c_str(), pindex->nHeight, pindex->GetStakeEntropyBit()); + printf("ComputeNextStakeModifier: selected round %d stop=%s height=%d bit=%d\n", nRound, DateTimeStrFormat(nSelectionIntervalStop).c_str(), pindex->nHeight, pindex->GetStakeEntropyBit()); } // Print selection map for visualization of the selected blocks @@ -251,10 +248,8 @@ static bool GetKernelStakeModifier(uint256 hashBlockFrom, uint64& nStakeModifier // this ensures that the chance of getting a coinstake is proportional to the // amount of coin age one owns. // The reason this hash is chosen is the following: -// nStakeModifier: -// (v0.3) scrambles computation to make it very difficult to precompute -// future proof-of-stake at the time of the coin's confirmation -// (v0.2) nBits (deprecated): encodes all past block timestamps +// nStakeModifier: scrambles computation to make it very difficult to precompute +// future proof-of-stake at the time of the coin's confirmation // txPrev.block.nTime: prevent nodes from guessing a good timestamp to // generate transaction for future advantage // txPrev.offset: offset of txPrev inside block, to reduce the chance of @@ -287,16 +282,8 @@ bool CheckStakeKernelHash(unsigned int nBits, const CBlock& blockFrom, unsigned // this change increases active coins participating the hash and helps // to secure the network when proof-of-stake difficulty is low // - if(fTestNet || (STAKEWEIGHT_SWITCH_TIME < nTimeTx)) - { - // New rule since 01 Jan 2014: Maximum TimeWeight is 90 days. - nTimeWeight = min((int64)nTimeTx - txPrev.nTime - nStakeMinAge, (int64)nStakeMaxAge); - } - else - { - // Current rule: Maximum TimeWeight is 60 days. - nTimeWeight = min((int64)nTimeTx - txPrev.nTime, (int64)nStakeMaxAge) - nStakeMinAge; - } + // Maximum TimeWeight is 90 days. + nTimeWeight = min((int64)nTimeTx - txPrev.nTime - nStakeMinAge, (int64)nStakeMaxAge); CBigNum bnCoinDayWeight = CBigNum(nValueIn) * nTimeWeight / COIN / (24 * 60 * 60); targetProofOfStake = (bnCoinDayWeight * bnTargetPerCoinDay).getuint256(); @@ -320,8 +307,7 @@ bool CheckStakeKernelHash(unsigned int nBits, const CBlock& blockFrom, unsigned DateTimeStrFormat(nStakeModifierTime).c_str(), mapBlockIndex[hashBlockFrom]->nHeight, DateTimeStrFormat(blockFrom.GetBlockTime()).c_str()); - printf("CheckStakeKernelHash() : check protocol=%s modifier=0x%016"PRI64x" nTimeBlockFrom=%u nTxPrevOffset=%u nTimeTxPrev=%u nPrevout=%u nTimeTx=%u hashProof=%s\n", - "0.3", + printf("CheckStakeKernelHash() : check modifier=0x%016"PRI64x" nTimeBlockFrom=%u nTxPrevOffset=%u nTimeTxPrev=%u nPrevout=%u nTimeTx=%u hashProof=%s\n", nStakeModifier, nTimeBlockFrom, nTxPrevOffset, txPrev.nTime, prevout.n, nTimeTx, hashProofOfStake.ToString().c_str()); @@ -337,8 +323,7 @@ bool CheckStakeKernelHash(unsigned int nBits, const CBlock& blockFrom, unsigned DateTimeStrFormat(nStakeModifierTime).c_str(), mapBlockIndex[hashBlockFrom]->nHeight, DateTimeStrFormat(blockFrom.GetBlockTime()).c_str()); - printf("CheckStakeKernelHash() : pass protocol=%s modifier=0x%016"PRI64x" nTimeBlockFrom=%u nTxPrevOffset=%u nTimeTxPrev=%u nPrevout=%u nTimeTx=%u hashProof=%s\n", - "0.3", + printf("CheckStakeKernelHash() : pass modifier=0x%016"PRI64x" nTimeBlockFrom=%u nTxPrevOffset=%u nTimeTxPrev=%u nPrevout=%u nTimeTx=%u hashProof=%s\n", nStakeModifier, nTimeBlockFrom, nTxPrevOffset, txPrev.nTime, prevout.n, nTimeTx, hashProofOfStake.ToString().c_str()); diff --git a/src/main.cpp b/src/main.cpp index 7e62654..b0eddf0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -476,8 +476,8 @@ bool CTransaction::CheckTransaction() const if (txout.IsEmpty() && !IsCoinBase() && !IsCoinStake()) return DoS(100, error("CTransaction::CheckTransaction() : txout empty for user transaction")); - // NovaCoin: enforce minimum output amount for user transactions - if (!IsCoinBase() && !txout.IsEmpty() && txout.nValue < MIN_TXOUT_AMOUNT) + // NovaCoin: enforce minimum output amount for user transactions until 1 May 2014 04:00:00 GMT + if (!fTestNet && !IsCoinBase() && !txout.IsEmpty() && nTime < OUTPUT_SWITCH_TIME && txout.nValue < MIN_TXOUT_AMOUNT) return DoS(100, error("CTransaction::CheckTransaction() : txout.nValue below minimum")); if (txout.nValue > MAX_MONEY) @@ -1399,9 +1399,8 @@ unsigned int CTransaction::GetP2SHSigOpCount(const MapPrevTx& inputs) const return nSigOps; } -bool CTransaction::ConnectInputs(CTxDB& txdb, MapPrevTx inputs, - map& mapTestPool, const CDiskTxPos& posThisTx, - const CBlockIndex* pindexBlock, bool fBlock, bool fMiner, bool fStrictPayToScriptHash) +bool CTransaction::ConnectInputs(CTxDB& txdb, MapPrevTx inputs, map& mapTestPool, const CDiskTxPos& posThisTx, + const CBlockIndex* pindexBlock, bool fBlock, bool fMiner, bool fStrictPayToScriptHash) { // Take over previous transactions' spent pointers // fBlock is true when this is called from AcceptBlock when a new best-block is added to the blockchain @@ -1502,8 +1501,9 @@ bool CTransaction::ConnectInputs(CTxDB& txdb, MapPrevTx inputs, int64 nTxFee = nValueIn - GetValueOut(); if (nTxFee < 0) return DoS(100, error("ConnectInputs() : %s nTxFee < 0", GetHash().ToString().substr(0,10).c_str())); - // ppcoin: enforce transaction fees for every block - if (nTxFee < GetMinFee()) + + // enforce transaction fees for every block until 1 May 2014 04:00:00 GMT + if (!fTestNet && nTxFee < GetMinFee() && nTime < OUTPUT_SWITCH_TIME) return fBlock? DoS(100, error("ConnectInputs() : %s not paying required fee=%s, paid=%s", GetHash().ToString().substr(0,10).c_str(), FormatMoney(GetMinFee()).c_str(), FormatMoney(nTxFee).c_str())) : false; nFees += nTxFee; diff --git a/src/main.h b/src/main.h index 4955be9..267819b 100644 --- a/src/main.h +++ b/src/main.h @@ -43,7 +43,7 @@ static const unsigned int STAKE_SWITCH_TIME = 1371686400; // Thu, 20 Jun 2013 00 static const unsigned int TARGETS_SWITCH_TIME = 1374278400; // Sat, 20 Jul 2013 00:00:00 GMT static const unsigned int CHAINCHECKS_SWITCH_TIME = 1379635200; // Fri, 20 Sep 2013 00:00:00 GMT static const unsigned int STAKECURVE_SWITCH_TIME = 1382227200; // Sun, 20 Oct 2013 00:00:00 GMT -static const unsigned int STAKEWEIGHT_SWITCH_TIME = 1388534400; // Wed, 01 Jan 2014 00:00:00 GMT +static const unsigned int OUTPUT_SWITCH_TIME = 1398916800; // Thu, 01 May 2014 04:00:00 GMT inline bool MoneyRange(int64 nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); } diff --git a/src/version.h b/src/version.h index ee0a666..7775a76 100644 --- a/src/version.h +++ b/src/version.h @@ -25,7 +25,7 @@ extern const std::string CLIENT_DATE; // network protocol versioning // -static const int PROTOCOL_VERSION = 60010; +static const int PROTOCOL_VERSION = 60011; // earlier versions not supported as of Feb 2012, and are disconnected static const int MIN_PROTO_VERSION = 209; @@ -47,6 +47,6 @@ static const int MEMPOOL_GD_VERSION = 60002; #define DISPLAY_VERSION_MAJOR 0 #define DISPLAY_VERSION_MINOR 4 #define DISPLAY_VERSION_REVISION 4 -#define DISPLAY_VERSION_BUILD 5 +#define DISPLAY_VERSION_BUILD 6 #endif diff --git a/src/wallet.cpp b/src/wallet.cpp index 3c28c0a..349bbdf 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -1451,16 +1451,8 @@ uint64 CWallet::GetStakeWeight(const CKeyStore& keystore, enum StakeWeightMode m // this change increases active coins participating the hash and helps // to secure the network when proof-of-stake difficulty is low // - if(fTestNet || (STAKEWEIGHT_SWITCH_TIME < nTime)) - { - // New rule since 01 Jan 2014: Maximum TimeWeight is 90 days. - nTimeWeight = min((int64)GetTime() - nTime - nStakeMinAge, (int64)nStakeMaxAge); - } - else - { - // Current rule: Maximum TimeWeight is 60 days. - nTimeWeight = min((int64)GetTime() - nTime, (int64)nStakeMaxAge) - nStakeMinAge; - } + // Maximum TimeWeight is 90 days. + nTimeWeight = min((int64)GetTime() - nTime - nStakeMinAge, (int64)nStakeMaxAge); CBigNum bnCoinDayWeight = CBigNum(pcoin.first->vout[pcoin.second].nValue) * nTimeWeight / COIN / (24 * 60 * 60); -- 1.7.1