Make indentation in ActivateBestChainStep readable

This commit is contained in:
Matt Corallo 2015-09-09 14:54:11 -07:00 committed by Jack Grigg
parent c944d161fd
commit 5aa165d557
No known key found for this signature in database
GPG Key ID: 665DBCD284F7DAFF
1 changed files with 32 additions and 32 deletions

View File

@ -2642,43 +2642,43 @@ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMo
bool fContinue = true; bool fContinue = true;
int nHeight = pindexFork ? pindexFork->nHeight : -1; int nHeight = pindexFork ? pindexFork->nHeight : -1;
while (fContinue && nHeight != pindexMostWork->nHeight) { while (fContinue && nHeight != pindexMostWork->nHeight) {
// Don't iterate the entire list of potential improvements toward the best tip, as we likely only need // Don't iterate the entire list of potential improvements toward the best tip, as we likely only need
// a few blocks along the way. // a few blocks along the way.
int nTargetHeight = std::min(nHeight + 32, pindexMostWork->nHeight); int nTargetHeight = std::min(nHeight + 32, pindexMostWork->nHeight);
vpindexToConnect.clear(); vpindexToConnect.clear();
vpindexToConnect.reserve(nTargetHeight - nHeight); vpindexToConnect.reserve(nTargetHeight - nHeight);
CBlockIndex *pindexIter = pindexMostWork->GetAncestor(nTargetHeight); CBlockIndex *pindexIter = pindexMostWork->GetAncestor(nTargetHeight);
while (pindexIter && pindexIter->nHeight != nHeight) { while (pindexIter && pindexIter->nHeight != nHeight) {
vpindexToConnect.push_back(pindexIter); vpindexToConnect.push_back(pindexIter);
pindexIter = pindexIter->pprev; pindexIter = pindexIter->pprev;
} }
nHeight = nTargetHeight; nHeight = nTargetHeight;
// Connect new blocks. // Connect new blocks.
BOOST_REVERSE_FOREACH(CBlockIndex *pindexConnect, vpindexToConnect) { BOOST_REVERSE_FOREACH(CBlockIndex *pindexConnect, vpindexToConnect) {
if (!ConnectTip(state, pindexConnect, pindexConnect == pindexMostWork ? pblock : NULL)) { if (!ConnectTip(state, pindexConnect, pindexConnect == pindexMostWork ? pblock : NULL)) {
if (state.IsInvalid()) { if (state.IsInvalid()) {
// The block violates a consensus rule. // The block violates a consensus rule.
if (!state.CorruptionPossible()) if (!state.CorruptionPossible())
InvalidChainFound(vpindexToConnect.back()); InvalidChainFound(vpindexToConnect.back());
state = CValidationState(); state = CValidationState();
fInvalidFound = true; fInvalidFound = true;
fContinue = false; fContinue = false;
break; break;
} else {
// A system error occurred (disk space, database error, ...).
return false;
}
} else { } else {
// A system error occurred (disk space, database error, ...). PruneBlockIndexCandidates();
return false; if (!pindexOldTip || chainActive.Tip()->nChainWork > pindexOldTip->nChainWork) {
} // We're in a better position than we were. Return temporarily to release the lock.
} else { fContinue = false;
PruneBlockIndexCandidates(); break;
if (!pindexOldTip || chainActive.Tip()->nChainWork > pindexOldTip->nChainWork) { }
// We're in a better position than we were. Return temporarily to release the lock.
fContinue = false;
break;
} }
} }
} }
}
// Callbacks/notifications for a new best chain. // Callbacks/notifications for a new best chain.
if (fInvalidFound) if (fInvalidFound)