Large blockchain re-orgs can fail #925

issue gavinandresen opened this issue on March 10, 2012
  1. gavinandresen commented at 8:29 PM on March 10, 2012: contributor

    TD and jrmithdobbs ran into this with version 0.6rc1.

    What happened:

    Block 170060 has an invalid-under-new-rules BIP16 transaction. That block is rejected by 0.6rc1 unless you run with the -paytoscripthashtime= argument to move the BIP16 acceptance date.

    There is a fairly long alternative chain fork at that point, because a couple of mining pool operators who were supporting BIP16 didn't restart their bitcoind's with the new BIP16 deadline.

    The 0.6rc1 code will save both chains to disk, but rejects the longer as invalid. So far, so good.

    The bug: If you upgrade or set -paytoscripthashtime to the correct date then the next found block will trigger a really big reorg operation. And with the settings we're using for Berkeley DB, that re-org fails because the database code runs out of locks.

    Workarounds: recompile bitcoin so bdb allocated more locks. Or re-download the blockchain.

    Short-term fix: Add a command-line flag so anybody who runs into this issue can just re-run with more locks.

    Long-term fix: Rework the block re-org code so it doesn't create one massive database transaction.

  2. gmaxwell commented at 8:39 PM on March 10, 2012: contributor

    I attempted to reproduce this (after jrmithdobbs mentioned it) by copying the chain to some isolated nodes, modifiying it so difficulty 1 was accepted and try to reorg the real chain onto short splits I created. I was unsuccessful, though I'm not sure why.

    One unexplained thing is that some people on the fork upgraded to rc2 even as late as today and reorged with no trouble. Differences in BDB versions?

  3. gmaxwell closed this on Mar 12, 2012

  4. coblee referenced this in commit ea1c925697 on Jul 17, 2012
  5. suprnurd referenced this in commit 36c28fad1b on Dec 5, 2017
  6. dexX7 referenced this in commit 2f61e1f6bb on May 14, 2019
  7. lateminer referenced this in commit a9827a0e63 on Oct 30, 2019
  8. sipa referenced this in commit c020cbaa5c on Jul 14, 2021
  9. MarcoFalke 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-19 12:16 UTC

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