Page MenuHomePhabricator

refactor: Move early loadtxoutset checks into ActiveSnapshot
ClosedPublic

Authored by PiRK on Tue, May 6, 20:29.

Details

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