mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
Merge bitcoin/bitcoin#25079: index: Change sync variables to use std::chrono::steady_clock
92b35aba224ad4440f3ea6c01c841596a6a3d6f4 index, refactor: Change sync variables to use `std::chrono::steady_clock` (w0xlt) Pull request description: This PR refactors the sync variables to use `std::chrono::steady_clock` as it is best suitable for measuring intervals. ACKs for top commit: jonatack: utACK 92b35aba224ad4440f3ea6c01c841596a6a3d6f4 ajtowns: ACK 92b35aba224ad4440f3ea6c01c841596a6a3d6f4 - code review only Tree-SHA512: cd4bafde47b30beb88c0aac247e41b4dced2ff2845c67a7043619da058dcff4f84374a7c704a698f3055c888d076d25503c2f38ace8fbc5456f624e0efe1e188
This commit is contained in:
parent
fb3d9a16bf
commit
6d534eebbc
@ -15,8 +15,8 @@
|
||||
|
||||
constexpr char DB_BEST_BLOCK = 'B';
|
||||
|
||||
constexpr int64_t SYNC_LOG_INTERVAL = 30; // seconds
|
||||
constexpr int64_t SYNC_LOCATOR_WRITE_INTERVAL = 30; // seconds
|
||||
constexpr auto SYNC_LOG_INTERVAL{30s};
|
||||
constexpr auto SYNC_LOCATOR_WRITE_INTERVAL{30s};
|
||||
|
||||
template <typename... Args>
|
||||
static void FatalError(const char* fmt, const Args&... args)
|
||||
@ -127,8 +127,8 @@ void BaseIndex::ThreadSync()
|
||||
if (!m_synced) {
|
||||
auto& consensus_params = Params().GetConsensus();
|
||||
|
||||
int64_t last_log_time = 0;
|
||||
int64_t last_locator_write_time = 0;
|
||||
std::chrono::steady_clock::time_point last_log_time{0s};
|
||||
std::chrono::steady_clock::time_point last_locator_write_time{0s};
|
||||
while (true) {
|
||||
if (m_interrupt) {
|
||||
m_best_block_index = pindex;
|
||||
@ -157,7 +157,7 @@ void BaseIndex::ThreadSync()
|
||||
pindex = pindex_next;
|
||||
}
|
||||
|
||||
int64_t current_time = GetTime();
|
||||
auto current_time{std::chrono::steady_clock::now()};
|
||||
if (last_log_time + SYNC_LOG_INTERVAL < current_time) {
|
||||
LogPrintf("Syncing %s with block chain from height %d\n",
|
||||
GetName(), pindex->nHeight);
|
||||
|
Loading…
Reference in New Issue
Block a user