mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-21 07:39:08 +01:00
test: exercise index reorg assertion failure
This commit is contained in:
@@ -186,8 +186,8 @@ void BaseIndex::Sync()
|
||||
{
|
||||
const CBlockIndex* pindex = m_best_block_index.load();
|
||||
if (!m_synced) {
|
||||
std::chrono::steady_clock::time_point last_log_time{0s};
|
||||
std::chrono::steady_clock::time_point last_locator_write_time{0s};
|
||||
auto last_log_time{NodeClock::now()};
|
||||
auto last_locator_write_time{last_log_time};
|
||||
while (true) {
|
||||
if (m_interrupt) {
|
||||
LogInfo("%s: m_interrupt set; exiting ThreadSync", GetName());
|
||||
@@ -229,14 +229,13 @@ void BaseIndex::Sync()
|
||||
|
||||
if (!ProcessBlock(pindex)) return; // error logged internally
|
||||
|
||||
auto current_time{std::chrono::steady_clock::now()};
|
||||
if (last_log_time + SYNC_LOG_INTERVAL < current_time) {
|
||||
LogInfo("Syncing %s with block chain from height %d",
|
||||
GetName(), pindex->nHeight);
|
||||
auto current_time{NodeClock::now()};
|
||||
if (current_time - last_log_time >= SYNC_LOG_INTERVAL) {
|
||||
LogInfo("Syncing %s with block chain from height %d", GetName(), pindex->nHeight);
|
||||
last_log_time = current_time;
|
||||
}
|
||||
|
||||
if (last_locator_write_time + SYNC_LOCATOR_WRITE_INTERVAL < current_time) {
|
||||
if (current_time - last_locator_write_time >= SYNC_LOCATOR_WRITE_INTERVAL) {
|
||||
SetBestBlockIndex(pindex);
|
||||
last_locator_write_time = current_time;
|
||||
// No need to handle errors in Commit. See rationale above.
|
||||
|
||||
Reference in New Issue
Block a user