HomePhabricator

validation: Stricter assumeutxo error handling when renaming chainstates

Description

validation: Stricter assumeutxo error handling when renaming chainstates

Summary:

validation: Stricter assumeutxo error handling in LoadChainstate

Make LoadChainstate return an explicit error when snapshot validation succeeds,
but there is an error trying to replace the background chainstate with the
snapshot chainstate. Previously in this case LoadChainstate would trigger a
shutdown and return INTERRUPTED, now it will return an actual error code.

There's no real change to behavior other than error message being formatted a
little differently.

Motivation for this change is to replace error handling via callbacks with
error handling via return value ahead of
https://github.com/bitcoin/bitcoin/pull/27861

https://github.com/bitcoin/bitcoin/pull/27862/commits/1c7d08b9acd33aff343228ada7e058e606cb1062

validation: Stricter assumeutxo error handling in InvalidateCoinsDBOnDisk

Currently InvalidateCoinsDBOnDisk is calling AbortNode without an error to the
caller if it fails. Change it to return just return util::Result, and update
the caller to handle the error itself.

This causes the secondary error to be shown below the main error instead of the
other way around.

https://github.com/bitcoin/bitcoin/pull/27862/commits/1c7d08b9acd33aff343228ada7e058e606cb1062

This is a backport of core#27862

Test Plan:
The only change in behavior is the order of the error messages in logs, but there are currently no tests for these error messages, and there is currently no easy way to test this.
Just check that the code still compiles and does not break existing tested behavior.
ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D15624

Details

Provenance
Ryan Ofsky <ryan@ofsky.org>Authored on Jun 12 2023, 15:48
PiRKCommitted on Fri, Apr 19, 06:28
PiRKPushed on Fri, Apr 19, 06:28
Reviewer
Restricted Project
Differential Revision
D15624: validation: Stricter assumeutxo error handling when renaming chainstates
Parents
rABC5cfdcd1e6fcd: Replace pindex pointer with block reference
Branches
Unknown
Tags
Unknown