HomePhabricator

refactor: Move early loadtxoutset checks into ActiveSnapshot

Description

refactor: Move early loadtxoutset checks into ActiveSnapshot

Summary:

rpc: Fix race in loadtxoutset

The tip may have advanced, also if it did not, there is no reason to
have two variables point to the same block.

https://github.com/bitcoin/bitcoin/pull/29262/commits/fa9108941fa1a0e83484114e2d8a99d264c2ad09

The potential race just means that tip_hash in the RPC response could be different from "the hash of the base of the snapshot" (as documented in the RPC doc).
Note that this race cannot really happen in the functional test, as there are no blocks coming over the network during the loadtxoutset call (blocks are mined locally). It could have happened in the wild, with very limited impact. The node would keep working fine, but some users may have been confused by the RPC response.

refactor: Move early loadtxoutset checks into ActiveSnapshot

Also changes the return type of ActiveSnapshot to allow returning the
error message to the user of the loadtxoutset RPC.

https://github.com/bitcoin/bitcoin/pull/30267/commits/80315c011863d69e7785673283e4c9033fbcd5ac

refactor: Use named arguments to get path arg in loadtxoutset

rpc: Use untranslated error strings in loadtxoutset

core#30395

This is a partial backport of core#29262, core#30267 and core#30395

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

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

Details

Provenance
MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>Authored on Jan 17 2024, 15:42
PiRKCommitted on Wed, May 7, 13:04
PiRKPushed on Wed, May 7, 13:04
Reviewer
Restricted Project
Differential Revision
D18055: refactor: Move early loadtxoutset checks into ActiveSnapshot
Parents
rABC25f6ba3d50dd: Bump version to 0.31.3
Branches
Unknown
Tags
Unknown