MCPcopy Create free account
hub / github.com/ElementsProject/elements / operator()

Method operator()

src/validation.cpp:116–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114};
115
116bool CBlockIndexWorkComparator::operator()(const CBlockIndex *pa, const CBlockIndex *pb) const {
117 // First sort by most total work, ...
118 if (pa->nChainWork > pb->nChainWork) return false;
119 if (pa->nChainWork < pb->nChainWork) return true;
120
121 // ... then by earliest time received, ...
122 if (pa->nSequenceId < pb->nSequenceId) return false;
123 if (pa->nSequenceId > pb->nSequenceId) return true;
124
125 // Use pointer address as tie breaker (should only happen with blocks
126 // loaded from disk, as those all have id 0).
127 if (pa < pb) return false;
128 if (pa > pb) return true;
129
130 // Identical blocks.
131 return false;
132}
133
134/**
135 * Mutex to guard access to validation specific variables, such as reading

Callers

nothing calls this directly

Calls 3

VerifyScriptFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected