Skip to content

AssumeUTXO: allow retrying loadtxoutset after an interrupted load - #36542

Open
l0rinc wants to merge 2 commits into
bitcoin:masterfrom
l0rinc:l0rinc/assumeutxo-recover-cleanup
Open

l0rinc wants to merge 2 commits into
bitcoin:masterfrom
l0rinc:l0rinc/assumeutxo-recover-cleanup

Conversation

@l0rinc

@l0rinc l0rinc commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Problem: An interrupted loadtxoutset can leave an incomplete chainstate_snapshot database without its required base_blockhash marker. A later call can fail to open that database, requiring the operator to remove it manually before retrying.

Fix: Wipe the snapshot database before opening it so a later call can replace incomplete data. LevelDB acquires the database lock before deleting files, so a database held open by another load cannot be wiped. Also correct the startup warning to identify the missing marker and explain that retrying replaces the directory.

@DrahtBot

DrahtBot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

External sites

Reviews

See the guideline and AI policy for information on the review process.

Type Reviewers
ACK cyb3ralbert

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #36778 (AssumeUTXO: replace loadtxoutset RPC with a startup arg by l0rinc)
  • #36598 ([Demo] validation: remove AssumeUTXO by l0rinc)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@l0rinc l0rinc changed the title validation: remove leftover AssumeUTXO cleanup data validation: clean up failed AssumeUTXO databases Oct 20, 2026
@l0rinc
l0rinc force-pushed the l0rinc/assumeutxo-recover-cleanup branch from c40de00 to 6cd9fd0 Compare October 20, 2026 22:04
Record that an incomplete snapshot database prevents loadtxoutset until the operator removes its directory.
An interrupted snapshot load can leave a database without its base-block marker, preventing later loadtxoutset attempts.
Wipe the snapshot database before opening it so callers can retry without removing the directory manually.
Correct the startup warning to point at the missing marker and say that a retry replaces the directory.
@l0rinc l0rinc changed the title validation: clean up failed AssumeUTXO databases AssumeUTXO: allow retrying loadtxoutset after an interrupted load Oct 21, 2026
@l0rinc
l0rinc force-pushed the l0rinc/assumeutxo-recover-cleanup branch from 6cd9fd0 to 15a891d Compare October 21, 2026 09:04
@l0rinc

l0rinc commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

Found a simpler fix using the existing database wipe option, which lets interrupted loads be retried.

@cyb3ralbert

Copy link
Copy Markdown
Contributor

Should the regression test also cover a snapshot database whose LOCK is held by another process?

tACK 15a891d

Tested on Linux aarch64 (Debian 13, GCC 14.2.0):

  • restart-retry-pruned, restart-retry-default, readable-leftover-retry, and locked-leftover-retry passed. The locked case returned RPC error -1, left the database files unchanged, and the retry succeeded after the lock was released.
  • feature_assumeutxo.py passed in a direct slot run on the same head.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants