Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Josh Wilcox
crown-core
Commits
f4bc41fc
Commit
f4bc41fc
authored
10 years ago
by
Pieter Wuille
Browse files
Options
Download
Email Patches
Plain Diff
Rename setBlockIndexValid to setBlockIndexCandidates
parent
cbb893bd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main.cpp
+15
-15
src/main.cpp
with
15 additions
and
15 deletions
+15
-15
src/main.cpp
View file @
f4bc41fc
...
...
@@ -99,7 +99,7 @@ namespace {
// The set of all CBlockIndex entries with BLOCK_VALID_TRANSACTIONS or better that are at least
// as good as our current tip. Entries may be failed, though.
set<CBlockIndex*, CBlockIndexWorkComparator> setBlockIndex
Valid
;
set<CBlockIndex*, CBlockIndexWorkComparator> setBlockIndex
Candidates
;
// Number of nodes with fSyncStarted.
int nSyncStarted = 0;
// All pairs A->B, where A (or one if its ancestors) misses transactions, but B has transactions.
...
...
@@ -1318,7 +1318,7 @@ void static InvalidBlockFound(CBlockIndex *pindex, const CValidationState &state
if (!state.CorruptionPossible()) {
pindex->nStatus |= BLOCK_FAILED_VALID;
pblocktree->WriteBlockIndex(CDiskBlockIndex(pindex));
setBlockIndex
Valid
.erase(pindex);
setBlockIndex
Candidates
.erase(pindex);
InvalidChainFound(pindex);
}
}
...
...
@@ -1918,8 +1918,8 @@ static CBlockIndex* FindMostWorkChain() {
// Find the best candidate header.
{
std::set<CBlockIndex*, CBlockIndexWorkComparator>::reverse_iterator it = setBlockIndex
Valid
.rbegin();
if (it == setBlockIndex
Valid
.rend())
std::set<CBlockIndex*, CBlockIndexWorkComparator>::reverse_iterator it = setBlockIndex
Candidates
.rbegin();
if (it == setBlockIndex
Candidates
.rend())
return NULL;
pindexNew = *it;
}
...
...
@@ -1938,10 +1938,10 @@ static CBlockIndex* FindMostWorkChain() {
CBlockIndex *pindexFailed = pindexNew;
while (pindexTest != pindexFailed) {
pindexFailed->nStatus |= BLOCK_FAILED_CHILD;
setBlockIndex
Valid
.erase(pindexFailed);
setBlockIndex
Candidates
.erase(pindexFailed);
pindexFailed = pindexFailed->pprev;
}
setBlockIndex
Valid
.erase(pindexTest);
setBlockIndex
Candidates
.erase(pindexTest);
fInvalidAncestor = true;
break;
}
...
...
@@ -1990,15 +1990,15 @@ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMo
return false;
}
} else {
// Delete all entries in setBlockIndex
Valid
that are worse than our new current block.
// Delete all entries in setBlockIndex
Candidates
that are worse than our new current block.
// Note that we can't delete the current block itself, as we may need to return to it later in case a
// reorganization to a better block fails.
std::set<CBlockIndex*, CBlockIndexWorkComparator>::iterator it = setBlockIndex
Valid
.begin();
while (setBlockIndex
Valid
.value_comp()(*it, chainActive.Tip())) {
setBlockIndex
Valid
.erase(it++);
std::set<CBlockIndex*, CBlockIndexWorkComparator>::iterator it = setBlockIndex
Candidates
.begin();
while (setBlockIndex
Candidates
.value_comp()(*it, chainActive.Tip())) {
setBlockIndex
Candidates
.erase(it++);
}
// Either the current tip or a successor of it we're working towards is left in setBlockIndex
Valid
.
assert(!setBlockIndex
Valid
.empty());
// Either the current tip or a successor of it we're working towards is left in setBlockIndex
Candidates
.
assert(!setBlockIndex
Candidates
.empty());
if (!pindexOldTip || chainActive.Tip()->nChainWork > pindexOldTip->nChainWork) {
// We're in a better position than we were. Return temporarily to release the lock.
break;
...
...
@@ -2123,7 +2123,7 @@ bool ReceivedBlockTransactions(const CBlock &block, CValidationState& state, CBl
CBlockIndex *pindex = queue.front();
queue.pop_front();
pindex->nChainTx = (pindex->pprev ? pindex->pprev->nChainTx : 0) + pindex->nTx;
setBlockIndex
Valid
.insert(pindex);
setBlockIndex
Candidates
.insert(pindex);
std::pair<std::multimap<CBlockIndex*, CBlockIndex*>::iterator, std::multimap<CBlockIndex*, CBlockIndex*>::iterator> range = mapBlocksUnlinked.equal_range(pindex);
while (range.first != range.second) {
std::multimap<CBlockIndex*, CBlockIndex*>::iterator it = range.first;
...
...
@@ -2803,7 +2803,7 @@ bool static LoadBlockIndexDB()
}
}
if (pindex->IsValid(BLOCK_VALID_TRANSACTIONS) && (pindex->nChainTx || pindex->pprev == NULL))
setBlockIndex
Valid
.insert(pindex);
setBlockIndex
Candidates
.insert(pindex);
if (pindex->nStatus & BLOCK_FAILED_MASK && (!pindexBestInvalid || pindex->nChainWork > pindexBestInvalid->nChainWork))
pindexBestInvalid = pindex;
if (pindex->pprev)
...
...
@@ -2947,7 +2947,7 @@ bool CVerifyDB::VerifyDB(CCoinsView *coinsview, int nCheckLevel, int nCheckDepth
void UnloadBlockIndex()
{
mapBlockIndex.clear();
setBlockIndex
Valid
.clear();
setBlockIndex
Candidates
.clear();
chainActive.SetTip(NULL);
pindexBestInvalid = NULL;
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment