Add rpc command to allow block-chain rollbacks and re-submits to simulate splits #4060

issue SergioDemianLerner opened this issue on April 15, 2014
  1. SergioDemianLerner commented at 7:21 PM on April 15, 2014: contributor

    There are plenty of projects now that listen to bitcoind using its rpc interface and maintain a complementary view of the block-chain in a SQL database, sometimes adding extra information. These applications generally poll bitcoind at regular intervals. It's very difficult to audit how these applications respond to changes in the best-chain that involve a block rollback. Many times those application break because they were not tested enough in chain split scenarios. Also when creating another full bitcoin implementation, is good if one can simulate these scenarios by connecting the node in development to bitcoind and commanding bitcoind.

    Is there a way to do this already? If not, then I propose the addition of a new rpc command "truncate-and-submit-blocks": truncate-and-submit-blocks block-height number-of-blocks-to-submit block1-in-hex ... blockN-in-hex

    The idea of allowing the submission of multiple blocks is that the additions are done atomically, so other connected applications can be tested for sudden best-chain switches without other unpredictable race conditions.

    Also it's possible to implement only "truncate block_hight" but this requires the testing script to control when the complementary application polls for new data.

    Also a block-chain locking mechanism could help, allowing something like the following rpc commands:

    lock-block-chain truncate 200000 submitblock .... submitblock .... unlock-block-chain

  2. laanwj added the label Tests on Apr 23, 2014
  3. laanwj added the label Improvement on Apr 23, 2014
  4. laanwj commented at 8:36 AM on May 18, 2015: member

    Implemented as invalidateblock and reconsiderblock by #5369

  5. laanwj closed this on May 18, 2015

  6. DrahtBot locked this on Sep 8, 2021

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-04-22 06:16 UTC

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