Correct indentation

This commit is contained in:
R E Broadley 2014-04-30 14:57:11 +08:00
parent 48be9ceaa0
commit 6b29ccc9f9

View file

@ -74,53 +74,54 @@ const string strMessageMagic = "Bitcoin Signed Message:\n";
// Internal stuff // Internal stuff
namespace { namespace {
struct CBlockIndexWorkComparator struct CBlockIndexWorkComparator
{ {
bool operator()(CBlockIndex *pa, CBlockIndex *pb) { bool operator()(CBlockIndex *pa, CBlockIndex *pb) {
// First sort by most total work, ... // First sort by most total work, ...
if (pa->nChainWork > pb->nChainWork) return false; if (pa->nChainWork > pb->nChainWork) return false;
if (pa->nChainWork < pb->nChainWork) return true; if (pa->nChainWork < pb->nChainWork) return true;
// ... then by earliest time received, ... // ... then by earliest time received, ...
if (pa->nSequenceId < pb->nSequenceId) return false; if (pa->nSequenceId < pb->nSequenceId) return false;
if (pa->nSequenceId > pb->nSequenceId) return true; if (pa->nSequenceId > pb->nSequenceId) return true;
// Use pointer address as tie breaker (should only happen with blocks // Use pointer address as tie breaker (should only happen with blocks
// loaded from disk, as those all have id 0). // loaded from disk, as those all have id 0).
if (pa < pb) return false; if (pa < pb) return false;
if (pa > pb) return true; if (pa > pb) return true;
// Identical blocks. // Identical blocks.
return false; return false;
} }
}; };
CBlockIndex *pindexBestInvalid; CBlockIndex *pindexBestInvalid;
set<CBlockIndex*, CBlockIndexWorkComparator> setBlockIndexValid; // may contain all CBlockIndex*'s that have validness >=BLOCK_VALID_TRANSACTIONS, and must contain those who aren't failed // may contain all CBlockIndex*'s that have validness >=BLOCK_VALID_TRANSACTIONS, and must contain those who aren't failed
set<CBlockIndex*, CBlockIndexWorkComparator> setBlockIndexValid;
CCriticalSection cs_LastBlockFile; CCriticalSection cs_LastBlockFile;
CBlockFileInfo infoLastBlockFile; CBlockFileInfo infoLastBlockFile;
int nLastBlockFile = 0; int nLastBlockFile = 0;
// Every received block is assigned a unique and increasing identifier, so we // Every received block is assigned a unique and increasing identifier, so we
// know which one to give priority in case of a fork. // know which one to give priority in case of a fork.
CCriticalSection cs_nBlockSequenceId; CCriticalSection cs_nBlockSequenceId;
// Blocks loaded from disk are assigned id 0, so start the counter at 1. // Blocks loaded from disk are assigned id 0, so start the counter at 1.
uint32_t nBlockSequenceId = 1; uint32_t nBlockSequenceId = 1;
// Sources of received blocks, to be able to send them reject messages or ban // Sources of received blocks, to be able to send them reject messages or ban
// them, if processing happens afterwards. Protected by cs_main. // them, if processing happens afterwards. Protected by cs_main.
map<uint256, NodeId> mapBlockSource; map<uint256, NodeId> mapBlockSource;
// Blocks that are in flight, and that are in the queue to be downloaded. // Blocks that are in flight, and that are in the queue to be downloaded.
// Protected by cs_main. // Protected by cs_main.
struct QueuedBlock { struct QueuedBlock {
uint256 hash; uint256 hash;
int64_t nTime; // Time of "getdata" request in microseconds. int64_t nTime; // Time of "getdata" request in microseconds.
int nQueuedBefore; // Number of blocks in flight at the time of request. int nQueuedBefore; // Number of blocks in flight at the time of request.
}; };
map<uint256, pair<NodeId, list<QueuedBlock>::iterator> > mapBlocksInFlight; map<uint256, pair<NodeId, list<QueuedBlock>::iterator> > mapBlocksInFlight;
map<uint256, pair<NodeId, list<uint256>::iterator> > mapBlocksToDownload; map<uint256, pair<NodeId, list<uint256>::iterator> > mapBlocksToDownload;
} }
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////