Skip to content

wallet: Sync progress not saved if interrupted #25010

@ryanofsky

Description

@ryanofsky

Originally posted by @S3RK in #24984 (review)

With current implementation we don't save the rescan progress and on the next load we will have to start from scratch. Is it possible to save the last processed blocked at shutdown?

It would be nice if wallet code would call WriteBestBlock and save the last scan position if it is interrupted during a sync. This could be implemented by trying to save the scan position during the shutdown, or by just periodically saving the scan position after an interval, similar to indexing code which saves sync position once every 30 seconds:

bitcoin/src/index/base.cpp

Lines 170 to 175 in f0a834e

if (last_locator_write_time + SYNC_LOCATOR_WRITE_INTERVAL < current_time) {
SetBestBlockIndex(pindex);
last_locator_write_time = current_time;
// No need to handle errors in Commit. See rationale above.
Commit();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions