Rollback for dumptxoutset without invalidating blocks #33477

pull fjahr wants to merge 2 commits into bitcoin:master from fjahr:202509-better-rollback changing 2 files +193 −113
  1. fjahr commented at 9:15 pm on September 24, 2025: contributor

    This is an alternative approach to implement dumptxoutset with rollback that was discussed a few times. It does not rely on invalidateblock and reconsiderblock and instead creates a temporary copy of the coins DB, modifies this copy by rolling back as many blocks as necessary and then creating the dump from this temp copy DB. See also #29553 (comment), #32817 (comment) and #29565 discussions.

    The nice side-effects of this are that forks can not interfere with the rollback and network activity does not have to be suspended. But there are also some downsides when comparing to the current approach: this does require some additional disk space for the copied coins DB and performance is slower (master took 3m 17s vs 9m 16s in my last test with the code here). However, there is also not much code being added here, network can stay active throughout and performance would stay constant with this approach while it would impact master if there were forks that needed to be invalidated as well (see #33444 for the alternative approach), so this could still be considered a good trade-off.

  2. DrahtBot commented at 9:15 pm on September 24, 2025: contributor

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

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/33477.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    Concept ACK luke-jr

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #33444 (rpc: Fix dumptxoutset rollback with competing forks by enirox001)
    • #31560 (rpc: allow writing UTXO set to a named pipe, introduce dump_to_sqlite.sh script by theStack)

    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.

  3. fjahr force-pushed on Sep 24, 2025
  4. fjahr commented at 9:22 pm on September 24, 2025: contributor
    cc @Sjors since you were asking for this approach a few times :)
  5. fjahr force-pushed on Sep 24, 2025
  6. rpc: Don't invalidate blocks in dumptxoutset
    Instead this new approach uses a temporary coins db to roll back the
    UTXO set.
    f046286c0c
  7. test: Add dumptxoutset fork test 6d409d5970
  8. fjahr force-pushed on Sep 24, 2025
  9. luke-jr commented at 10:40 am on September 25, 2025: member

    Concept ACK, this seems cleaner.

    master took 3m 17s vs 9m 16s in my last test with the code here

    I suspect if you go back further, this approach will end up performing better because we no longer need to roll back forward at the end


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: 2025-09-26 15:13 UTC

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