aboutsummaryrefslogtreecommitdiff
path: root/src/index/base.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/index/base.cpp')
-rw-r--r--src/index/base.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/index/base.cpp b/src/index/base.cpp
index 9e637c9c6f..4079fc4569 100644
--- a/src/index/base.cpp
+++ b/src/index/base.cpp
@@ -8,12 +8,12 @@
#include <node/ui_interface.h>
#include <shutdown.h>
#include <tinyformat.h>
-#include <util/system.h>
+#include <util/thread.h>
#include <util/translation.h>
#include <validation.h> // For g_chainman
#include <warnings.h>
-constexpr char DB_BEST_BLOCK = 'B';
+constexpr uint8_t DB_BEST_BLOCK{'B'};
constexpr int64_t SYNC_LOG_INTERVAL = 30; // seconds
constexpr int64_t SYNC_LOCATOR_WRITE_INTERVAL = 30; // seconds
@@ -98,9 +98,7 @@ bool BaseIndex::Init()
}
}
if (prune_violation) {
- // throw error and graceful shutdown if we can't build the index
- FatalError("%s: %s best block of the index goes beyond pruned data. Please disable the index or reindex (which will download the whole blockchain again)", __func__, GetName());
- return false;
+ return InitError(strprintf(Untranslated("%s best block of the index goes beyond pruned data. Please disable the index or reindex (which will download the whole blockchain again)"), GetName()));
}
}
return true;
@@ -339,18 +337,17 @@ void BaseIndex::Interrupt()
m_interrupt();
}
-void BaseIndex::Start()
+bool BaseIndex::Start()
{
// Need to register this ValidationInterface before running Init(), so that
// callbacks are not missed if Init sets m_synced to true.
RegisterValidationInterface(this);
if (!Init()) {
- FatalError("%s: %s failed to initialize", __func__, GetName());
- return;
+ return false;
}
- m_thread_sync = std::thread(&TraceThread<std::function<void()>>, GetName(),
- std::bind(&BaseIndex::ThreadSync, this));
+ m_thread_sync = std::thread(&util::TraceThread, GetName(), [this] { ThreadSync(); });
+ return true;
}
void BaseIndex::Stop()