File tree Expand file tree Collapse file tree 2 files changed +19
-18
lines changed Expand file tree Collapse file tree 2 files changed +19
-18
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,25 @@ bool fHavePruned = false;
28
28
bool fPruneMode = false ;
29
29
uint64_t nPruneTarget = 0 ;
30
30
31
+ bool CBlockIndexWorkComparator::operator ()(const CBlockIndex* pa, const CBlockIndex* pb) const
32
+ {
33
+ // First sort by most total work, ...
34
+ if (pa->nChainWork > pb->nChainWork ) return false ;
35
+ if (pa->nChainWork < pb->nChainWork ) return true ;
36
+
37
+ // ... then by earliest time received, ...
38
+ if (pa->nSequenceId < pb->nSequenceId ) return false ;
39
+ if (pa->nSequenceId > pb->nSequenceId ) return true ;
40
+
41
+ // Use pointer address as tie breaker (should only happen with blocks
42
+ // loaded from disk, as those all have id 0).
43
+ if (pa < pb) return false ;
44
+ if (pa > pb) return true ;
45
+
46
+ // Identical blocks.
47
+ return false ;
48
+ }
49
+
31
50
static FILE* OpenUndoFile (const FlatFilePos& pos, bool fReadOnly = false );
32
51
static FlatFileSeq BlockFileSeq ();
33
52
static FlatFileSeq UndoFileSeq ();
Original file line number Diff line number Diff line change @@ -107,24 +107,6 @@ const std::vector<std::string> CHECKLEVEL_DOC {
107
107
" each level includes the checks of the previous levels" ,
108
108
};
109
109
110
- bool CBlockIndexWorkComparator::operator ()(const CBlockIndex *pa, const CBlockIndex *pb) const {
111
- // First sort by most total work, ...
112
- if (pa->nChainWork > pb->nChainWork ) return false ;
113
- if (pa->nChainWork < pb->nChainWork ) return true ;
114
-
115
- // ... then by earliest time received, ...
116
- if (pa->nSequenceId < pb->nSequenceId ) return false ;
117
- if (pa->nSequenceId > pb->nSequenceId ) return true ;
118
-
119
- // Use pointer address as tie breaker (should only happen with blocks
120
- // loaded from disk, as those all have id 0).
121
- if (pa < pb) return false ;
122
- if (pa > pb) return true ;
123
-
124
- // Identical blocks.
125
- return false ;
126
- }
127
-
128
110
/* *
129
111
* Mutex to guard access to validation specific variables, such as reading
130
112
* or changing the chainstate.
You can’t perform that action at this time.
0 commit comments