|
|
@ -32,8 +32,8 @@ map<COutPoint, CInPoint> mapNextTx; |
|
|
|
map<uint256, CBlockIndex*> mapBlockIndex; |
|
|
|
map<uint256, CBlockIndex*> mapBlockIndex; |
|
|
|
uint256 hashGenesisBlock("0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"); |
|
|
|
uint256 hashGenesisBlock("0x000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f"); |
|
|
|
CBigNum bnProofOfWorkLimit(~uint256(0) >> 32); |
|
|
|
CBigNum bnProofOfWorkLimit(~uint256(0) >> 32); |
|
|
|
const int nTotalBlocksEstimate = 131000; // Conservative estimate of total nr of blocks on main chain
|
|
|
|
const int nTotalBlocksEstimate = 134444; // Conservative estimate of total nr of blocks on main chain
|
|
|
|
const int nInitialBlockThreshold = 10000; // Regard blocks up until N-threshold as "initial download"
|
|
|
|
const int nInitialBlockThreshold = 120; // Regard blocks up until N-threshold as "initial download"
|
|
|
|
CBlockIndex* pindexGenesisBlock = NULL; |
|
|
|
CBlockIndex* pindexGenesisBlock = NULL; |
|
|
|
int nBestHeight = -1; |
|
|
|
int nBestHeight = -1; |
|
|
|
CBigNum bnBestChainWork = 0; |
|
|
|
CBigNum bnBestChainWork = 0; |
|
|
@ -1294,7 +1294,8 @@ bool CBlock::AcceptBlock() |
|
|
|
(nHeight == 70567 && hash != uint256("0x00000000006a49b14bcf27462068f1264c961f11fa2e0eddd2be0791e1d4124a")) || |
|
|
|
(nHeight == 70567 && hash != uint256("0x00000000006a49b14bcf27462068f1264c961f11fa2e0eddd2be0791e1d4124a")) || |
|
|
|
(nHeight == 74000 && hash != uint256("0x0000000000573993a3c9e41ce34471c079dcf5f52a0e824a81e7f953b8661a20")) || |
|
|
|
(nHeight == 74000 && hash != uint256("0x0000000000573993a3c9e41ce34471c079dcf5f52a0e824a81e7f953b8661a20")) || |
|
|
|
(nHeight == 105000 && hash != uint256("0x00000000000291ce28027faea320c8d2b054b2e0fe44a773f3eefb151d6bdc97")) || |
|
|
|
(nHeight == 105000 && hash != uint256("0x00000000000291ce28027faea320c8d2b054b2e0fe44a773f3eefb151d6bdc97")) || |
|
|
|
(nHeight == 118000 && hash != uint256("0x000000000000774a7f8a7a12dc906ddb9e17e75d684f15e00f8767f9e8f36553"))) |
|
|
|
(nHeight == 118000 && hash != uint256("0x000000000000774a7f8a7a12dc906ddb9e17e75d684f15e00f8767f9e8f36553")) || |
|
|
|
|
|
|
|
(nHeight == 134444 && hash != uint256("0x00000000000005b12ffd4cd315cd34ffd4a594f430ac814c91184a0d42d2b0fe"))) |
|
|
|
return error("AcceptBlock() : rejected by checkpoint lockin at %d", nHeight); |
|
|
|
return error("AcceptBlock() : rejected by checkpoint lockin at %d", nHeight); |
|
|
|
|
|
|
|
|
|
|
|
// Write block to history file
|
|
|
|
// Write block to history file
|
|
|
@ -1311,7 +1312,7 @@ bool CBlock::AcceptBlock() |
|
|
|
if (hashBestChain == hash) |
|
|
|
if (hashBestChain == hash) |
|
|
|
CRITICAL_BLOCK(cs_vNodes) |
|
|
|
CRITICAL_BLOCK(cs_vNodes) |
|
|
|
BOOST_FOREACH(CNode* pnode, vNodes) |
|
|
|
BOOST_FOREACH(CNode* pnode, vNodes) |
|
|
|
if (nBestHeight > (pnode->nStartingHeight != -1 ? pnode->nStartingHeight - 2000 : 118000)) |
|
|
|
if (nBestHeight > (pnode->nStartingHeight != -1 ? pnode->nStartingHeight - 2000 : 134444)) |
|
|
|
pnode->PushInventory(CInv(MSG_BLOCK, hash)); |
|
|
|
pnode->PushInventory(CInv(MSG_BLOCK, hash)); |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
@ -2040,20 +2041,24 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) |
|
|
|
if (pindex) |
|
|
|
if (pindex) |
|
|
|
pindex = pindex->pnext; |
|
|
|
pindex = pindex->pnext; |
|
|
|
int nLimit = 500 + locator.GetDistanceBack(); |
|
|
|
int nLimit = 500 + locator.GetDistanceBack(); |
|
|
|
|
|
|
|
unsigned int nBytes = 0; |
|
|
|
printf("getblocks %d to %s limit %d\n", (pindex ? pindex->nHeight : -1), hashStop.ToString().substr(0,20).c_str(), nLimit); |
|
|
|
printf("getblocks %d to %s limit %d\n", (pindex ? pindex->nHeight : -1), hashStop.ToString().substr(0,20).c_str(), nLimit); |
|
|
|
for (; pindex; pindex = pindex->pnext) |
|
|
|
for (; pindex; pindex = pindex->pnext) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (pindex->GetBlockHash() == hashStop) |
|
|
|
if (pindex->GetBlockHash() == hashStop) |
|
|
|
{ |
|
|
|
{ |
|
|
|
printf(" getblocks stopping at %d %s\n", pindex->nHeight, pindex->GetBlockHash().ToString().substr(0,20).c_str()); |
|
|
|
printf(" getblocks stopping at %d %s (%u bytes)\n", pindex->nHeight, pindex->GetBlockHash().ToString().substr(0,20).c_str(), nBytes); |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
pfrom->PushInventory(CInv(MSG_BLOCK, pindex->GetBlockHash())); |
|
|
|
pfrom->PushInventory(CInv(MSG_BLOCK, pindex->GetBlockHash())); |
|
|
|
if (--nLimit <= 0) |
|
|
|
CBlock block; |
|
|
|
|
|
|
|
block.ReadFromDisk(pindex, true); |
|
|
|
|
|
|
|
nBytes += block.GetSerializeSize(SER_NETWORK); |
|
|
|
|
|
|
|
if (--nLimit <= 0 || nBytes >= SendBufferSize()/2) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// When this block is requested, we'll send an inv that'll make them
|
|
|
|
// When this block is requested, we'll send an inv that'll make them
|
|
|
|
// getblocks the next batch of inventory.
|
|
|
|
// getblocks the next batch of inventory.
|
|
|
|
printf(" getblocks stopping at limit %d %s\n", pindex->nHeight, pindex->GetBlockHash().ToString().substr(0,20).c_str()); |
|
|
|
printf(" getblocks stopping at limit %d %s (%u bytes)\n", pindex->nHeight, pindex->GetBlockHash().ToString().substr(0,20).c_str(), nBytes); |
|
|
|
pfrom->hashContinue = pindex->GetBlockHash(); |
|
|
|
pfrom->hashContinue = pindex->GetBlockHash(); |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|