Permalink
Browse files

Wrap GetMedianTimePast() in GetPastTimeLimit()

Also Update Checkpoints
  • Loading branch information...
Tranz5 committed Jul 21, 2014
1 parent e260f6d commit e500d0cbfee3b67e656d78e88811ee8ec8abc047
Showing with 19 additions and 12 deletions.
  1. +7 −5 src/checkpoints.cpp
  2. +3 −3 src/main.cpp
  3. +5 −0 src/main.h
  4. +2 −2 src/miner.cpp
  5. +2 −2 src/rpcmining.cpp
View
@@ -25,11 +25,13 @@ namespace Checkpoints
static MapCheckpoints mapCheckpoints =
boost::assign::map_list_of
( 0, hashGenesisBlockOfficial )
( 50000, uint256("0x00000002751f54b06ffac8da64d221babf48e9d82365c08c20e82585d674e6b6"))
( 110465, uint256("0x000000022e2e3c4a5d305aaf8d01b1bbb0fc5afccc0fb65dad642b333fdc2cd8"))
( 210943, uint256("0x000000029af45dc0e3bcb929fe1e060593a59c2fd983ee57c769bce83d1f6e86"))
( 265734, uint256("0x00000004d7a22505fb8a091c6fed6bc6c66f7ccc4789c396dc9fdb6f511d2945"))
( 411000, uint256("0x000000010c06d563dfe062ac53d7765dedc18e16de9457d0e5742255887965bc"))
( 50000, uint256("0x00000002751f54b06ffac8da64d221babf48e9d82365c08c20e82585d674e6b6"))
( 110465, uint256("0x000000022e2e3c4a5d305aaf8d01b1bbb0fc5afccc0fb65dad642b333fdc2cd8"))
( 210943, uint256("0x000000029af45dc0e3bcb929fe1e060593a59c2fd983ee57c769bce83d1f6e86"))
( 265734, uint256("0x00000004d7a22505fb8a091c6fed6bc6c66f7ccc4789c396dc9fdb6f511d2945"))
( 411000, uint256("0x000000010c06d563dfe062ac53d7765dedc18e16de9457d0e5742255887965bc"))
( 750000, uint256("0xcda70f71ae25ef36fd7954b27067f7b4e11c6d0f3e162d53086a7516a4b067ca"))
( 1000000, uint256("0x356be281863d1a006da922d184f81065db45d5ba1302ccedabed5175b8637994"))
;
static MapCheckpoints mapCheckpointsTestnet =
View
@@ -2243,7 +2243,7 @@ bool CBlock::AcceptBlock()
return DoS(100, error("AcceptBlock() : incorrect %s", IsProofOfWork() ? "proof-of-work" : "proof-of-stake"));
// Check timestamp against prev
if (GetBlockTime() <= pindexPrev->GetMedianTimePast() || FutureDrift(GetBlockTime()) < pindexPrev->GetBlockTime())
if (GetBlockTime() <= pindexPrev->GetPastTimeLimit() || FutureDrift(GetBlockTime()) < pindexPrev->GetBlockTime())
return error("AcceptBlock() : block's timestamp is too early");
// Check that all transactions are finalized
@@ -2474,12 +2474,12 @@ bool CBlock::SignPoSBlock(CWallet& wallet)
{
if (wallet.CreateCoinStake(wallet, nBits, nSearchTime-nLastCoinStakeSearchTime, txCoinStake, key))
{
if (txCoinStake.nTime >= max(pindexBest->GetMedianTimePast()+1, PastDrift(pindexBest->GetBlockTime())))
if (txCoinStake.nTime >= max(pindexBest->GetPastTimeLimit()+1, PastDrift(pindexBest->GetBlockTime())))
{
// make sure coinstake would meet timestamp protocol
// as it would be the same as the block timestamp
vtx[0].nTime = nTime = txCoinStake.nTime;
nTime = max(pindexBest->GetMedianTimePast()+1, GetMaxTransactionTime());
nTime = max(pindexBest->GetPastTimeLimit()+1, GetMaxTransactionTime());
nTime = max(GetBlockTime(), PastDrift(pindexBest->GetBlockTime()));
// we have to make sure that we have no future timestamps in
View
@@ -1279,6 +1279,11 @@ class CBlockIndex
return true;
}
int64 GetPastTimeLimit() const
{
return GetMedianTimePast();
}
enum { nMedianTimeSpan=11 };
int64 GetMedianTimePast() const
View
@@ -364,7 +364,7 @@ CBlock* CreateNewBlock(CWallet* pwallet, bool fProofOfStake)
// Fill in header
pblock->hashPrevBlock = pindexPrev->GetBlockHash();
pblock->nTime = max(pindexPrev->GetMedianTimePast()+1, pblock->GetMaxTransactionTime());
pblock->nTime = max(pindexPrev->GetPastTimeLimit()+1, pblock->GetMaxTransactionTime());
pblock->nTime = max(pblock->GetBlockTime(), PastDrift(pindexPrev->GetBlockTime()));
if (!fProofOfStake)
pblock->UpdateTime(pindexPrev);
@@ -676,7 +676,7 @@ void BitcoinMiner(CWallet *pwallet)
break;
// Update nTime every few seconds
pblock->nTime = max(pindexPrev->GetMedianTimePast()+1, pblock->GetMaxTransactionTime());
pblock->nTime = max(pindexPrev->GetPastTimeLimit()+1, pblock->GetMaxTransactionTime());
pblock->nTime = max(pblock->GetBlockTime(), PastDrift(pindexPrev->GetBlockTime()));
pblock->UpdateTime(pindexPrev);
nBlockTime = ByteReverse(pblock->nTime);
View
@@ -160,7 +160,7 @@ Value getworkex(CWallet* pWallet, const Array& params, bool fHelp)
}
// Update nTime
pblock->nTime = max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
pblock->nTime = max(pindexPrev->GetPastTimeLimit()+1, GetAdjustedTime());
pblock->nNonce = 0;
// Update nExtraNonce
@@ -502,7 +502,7 @@ Value getblocktemplate(CWallet* pWallet, const Array& params, bool fHelp)
result.push_back(Pair("coinbaseaux", aux));
result.push_back(Pair("coinbasevalue", (int64_t)pblock->vtx[0].vout[0].nValue));
result.push_back(Pair("target", hashTarget.GetHex()));
result.push_back(Pair("mintime", (int64_t)pindexPrev->GetMedianTimePast()+1));
result.push_back(Pair("mintime", (int64_t)pindexPrev->GetPastTimeLimit()+1));
result.push_back(Pair("mutable", aMutable));
result.push_back(Pair("noncerange", "00000000ffffffff"));
result.push_back(Pair("sigoplimit", (int64_t)MAX_BLOCK_SIGOPS));

0 comments on commit e500d0c

Please sign in to comment.