-stopatheight is imprecise #13477

issue Sjors opened this issue on June 15, 2018
  1. Sjors commented at 12:59 PM on June 15, 2018: member

    As of latest master (2b770080a49f282e51b7e4d176b2d9fbe0f8f5db).

    src/bitcoind -testnet -stopatheight=100000
    
    ...
    
    2018-06-15T12:49:59Z UpdateTip: new best=000000000086a985696447c96c8a3520dbe5536287ef9fbf5b220b66fdb684c7 height=100208 version=0x00000002 log2_work=54.043471 tx=599130 date='2013-08-11T14:57:43Z' progress=0.032961 cache=43.5MiB(302489txo)
    2018-06-15T12:49:59Z UpdateTip: new best=000000000060c93d2cf7a5cd5ce510c31cf96b983ee64ec5c627cf2055249500 height=100209 version=0x00000002 log2_work=54.043562 tx=599131 date='2013-08-11T15:01:20Z' progress=0.032961 cache=43.5MiB(302490txo)
    2018-06-15T12:49:59Z Shutdown: In progress...
    2018-06-15T12:49:59Z addcon thread exit
    2018-06-15T12:49:59Z net thread exit
    2018-06-15T12:49:59Z UpdateTip: new best=000000000075b13f384b05ac740b776593dc4f53d2d92cf9c2a81475335a3cef height=100210 version=0x00000002 log2_work=54.043653 tx=599136 date='2013-08-11T15:09:42Z' progress=0.032961 cache=43.5MiB(302495txo)
    2018-06-15T12:49:59Z msghand thread exit
    2018-06-15T12:50:01Z opencon thread exit
    2018-06-15T12:50:01Z scheduler thread interrupt
    2018-06-15T12:50:01Z Dumped mempool: 7e-06s to copy, 0.00237s to dump
    2018-06-15T12:50:07Z Shutdown: done
    

    Having precise control can be useful for generating a deterministic blockchain snapshot. That in turn could be useful when bootstrapping a low performance device (though hopefully #9483 will make that unnecessary), as well as for validating the chain in parallel on multiple machines.

    One easy solution might be to just roll back to the target.

  2. laanwj added the label Validation on Jun 15, 2018
  3. qmma70 cross-referenced this on Jun 18, 2018 from issue Break when active block tip is higher than nStopAtHeight by qmma70
  4. jonasschnelli cross-referenced this on Jul 19, 2018 from issue Ignore new blocks when -stopatheight target has been reached by jonasschnelli
  5. Sjors commented at 3:13 PM on September 8, 2018: member

    See discussion at #13713 and #13490 for whether this is a good idea or not.

  6. promag cross-referenced this on Jul 18, 2019 from issue Bitcoind become unresponsive to CLI during UpdateTip phase. by SylTi
  7. Sjors commented at 8:52 AM on October 29, 2019: member

    It's still imprecise as of master @ 4c1090c882ea15ba4d10a2f7f320f3c0eb490ebd.

    An alternative way to create a blockchain snapshot is to call invalidateblock on the next height. This approach is used in #16899. I don't think that's an ideal solution though; if there's forks you have to invalidate all of them, and if you don't shutdown p2p it starts disconnecting peers. So I'd prefer a more robust RPC call for this purpose like rollbacktoheight, which also requires fixing this precision issue.

  8. Sjors commented at 12:21 PM on January 6, 2021: member

    @jamesob do you think this issue is still relevant for the way you generate UTXO snapshots?

  9. Sjors commented at 12:48 PM on September 6, 2022: member

    Closing this because utxo_snapshot.sh uses invalidateblock to wind back.

  10. Sjors closed this on Sep 6, 2022

  11. dfinity-berestovskyy cross-referenced this on Nov 25, 2022 from issue Fix compute scripts by dfinity-berestovskyy
  12. mzumsande cross-referenced this on Jul 11, 2023 from issue kernel: Remove StartShutdown calls from validation code by ryanofsky
  13. bitcoin locked this on Sep 6, 2023

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-05-20 06:55 UTC