@@ -308,41 +308,6 @@ bool CBlockTreeDB::WritePAKList(const std::vector<std::vector<unsigned char> >&
308308 return Write (std::make_pair (DB_PAK, uint256S (" 1" )), offline_list) && Write (std::make_pair (DB_PAK, uint256S (" 2" )), online_list) && Write (std::make_pair (DB_PAK, uint256S (" 3" )), reject);
309309}
310310
311- /* * Note that we only get a conservative (lower) estimate of the max header height here,
312- * obtained by sampling the first 10,000 headers on disk (which are in random order) and
313- * taking the highest block we see. */
314- bool CBlockTreeDB::WalkBlockIndexGutsForMaxHeight (int * nHeight) {
315- std::unique_ptr<CDBIterator> pcursor (NewIterator ());
316- *nHeight = 0 ;
317- int i = 0 ;
318- pcursor->Seek (std::make_pair (DB_BLOCK_INDEX, uint256 ()));
319- while (pcursor->Valid ()) {
320- if (ShutdownRequested ()) return false ;
321- std::pair<uint8_t , uint256> key;
322- if (pcursor->GetKey (key) && key.first == DB_BLOCK_INDEX) {
323- i++;
324- if (i > 10'000 ) {
325- // Under the (accurate) assumption that the headers on disk are effectively in random height order,
326- // we have a good-enough (conservative) estimate of the max height very quickly, and don't need to
327- // waste more time. Shortcutting like this will cause us to keep a few extra headers, which is fine.
328- break ;
329- }
330- CDiskBlockIndex diskindex;
331- if (pcursor->GetValue (diskindex)) {
332- if (diskindex.nHeight > *nHeight) {
333- *nHeight = diskindex.nHeight ;
334- }
335- pcursor->Next ();
336- } else {
337- return error (" %s: failed to read value" , __func__);
338- }
339- } else {
340- break ;
341- }
342- }
343- return true ;
344- }
345-
346311const CBlockIndex *CBlockTreeDB::RegenerateFullIndex (const CBlockIndex *pindexTrimmed, CBlockIndex *pindexNew) const
347312{
348313 if (!pindexTrimmed->trimmed ()) {
0 commit comments