`dumptxoutset` rollback feature does not take forks into account #32817

issue sipa opened this issue on June 26, 2025
  1. sipa commented at 12:35 PM on June 26, 2025: member

    In the dumptxoutset RPC, when the rollback feature is used with a height H, it will issue an InvalidateBlock on the active-chain block at height H+1. However, if an inactive branch of the chain exists that forks off at height H or below, and extends to block H+1 or later (or has equivalent PoW to that), InvalidateBlock will reorg there, and dump will be for the tip of that branch, rather than the height-H ancestor of the main chain.

    I have not tested this to verify, so it is possible I am missing something.

  2. Sjors commented at 2:03 PM on June 26, 2025: member

    cc @fjahr

  3. fjahr commented at 3:55 PM on June 26, 2025: contributor

    Sigh, yeah, that's probably right. When taken to an extreme (aka Testnet4) that's a really annoying problem as I have experienced in #31117. Since I have to deal with this anyway so I will address this soon.

  4. maflcko commented at 3:59 PM on June 26, 2025: member

    Isn't this addressed by the throw here?

    https://github.com/bitcoin/bitcoin/blob/67ea4b9994e668dcea5e5d0f62f886d92e3737dc/src/rpc/blockchain.cpp#L3111

    I think there is still a race when calling submitblock, but this doesn't seem related to forks per se.

  5. sipa commented at 4:03 PM on June 26, 2025: member

    @maflcko Right! So indeed, it won't (ignoring race conditions) dump the wrong thing - but if you have a fork at a certain height, you'll just be unable to dump at that height.

  6. maflcko commented at 4:08 PM on June 26, 2025: member

    you'll just be unable to dump at that height.

    Could do a manual invalidateblock of the low-work forks to work around the error, but yea, could be annoying if the forks are more than 1, or longer than 1 block.

  7. maflcko added the label RPC/REST/ZMQ on Jun 26, 2025
  8. mzumsande commented at 4:48 PM on June 26, 2025: contributor

    We could also automate it: Iterate over the block index to find all fork blocks at the target height and invalidate those too, only then do the invalidation on the main chain block / do the dump, and finally reconsider everything. Though I'm not sure if that would be overkill.

  9. Sjors commented at 9:51 AM on June 27, 2025: member

    This goes back to the discussion in #29565 that we shouldn't be using block invalidation as a hack to trigger the chain state manager into rolling back. Instead we should perform the rollback directly (though no need for a new RPC).

  10. enirox001 commented at 4:45 AM on September 23, 2025: contributor

    Opened the PR #33444 to address this issue

  11. sedited referenced this in commit 378e17f703 on Apr 19, 2026
  12. Kino1994 referenced this in commit 02924c4352 on Jun 28, 2026
  13. BigcoinBGC referenced this in commit e70707b58f on Jun 30, 2026
  14. fjahr commented at 3:45 PM on July 10, 2026: contributor

    This was addressed with #33477 and can be closed.

  15. fanquake closed this on Jul 10, 2026


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-07-22 09:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me