BIP8: directly support special cases #1023

pull ajtowns wants to merge 1 commits into bitcoin:master from ajtowns:202010-bip8-edge-cases changing 1 files +11 −11
  1. ajtowns commented at 6:02 AM on October 19, 2020: contributor

    Rather than always having the genesis block be DEFINED, allow {0,0,true} to act as ALWAYS_ACTIVE and {0,0,false} to act as NEVER_ACTIVE, and {n,n,true} to act as a buried deployment.

    This cleans up the implementation a bit I think, removing the need for special case handling. (Note that in the {n,n,true} case n will still be rounded up to the next retarget period however)

  2. BIP8: directly support special cases
    Rather than always having the genesis block be DEFINED, allow
    {0,0,true} to act as ALWAYS_ACTIVE and {0,0,false} to act as
    NEVER_ACTIVE, and {n,n,true} to act as a buried deployment.
    18b6e3618f
  3. in bip-0008.mediawiki:117 in c2d4b384d8 outdated
     123 | +                if (lockinontimeout) {
     124 | +                    return ACTIVE;
     125 | +                } else {
     126 | +                    return FAILED;
     127 | +                }
     128 | +            } else if (block.height >= startheight) {
    


    ajtowns commented at 6:20 AM on October 19, 2020:

    Could also make it:

        } else if (block.height >= startheight) {
            if (lockinontimeout && block.height + 2016 >= timeoutheight) {
               return MUST_SIGNAL;
            } else {
               return STARTED;
            }
        }
    

    which would also remove the edge case from #1019.

  4. ajtowns force-pushed on Oct 19, 2020
  5. luke-jr added the label Proposed BIP modification on Oct 19, 2020
  6. luke-jr commented at 3:01 PM on October 19, 2020: member

    I wonder if this is needed in the BIP, or just implementation details that complicate the BIP.

  7. ajtowns commented at 1:25 AM on October 21, 2020: contributor

    Fair question. I think it makes the special cases ("what if timeout is less than start? what if they're not equal but in the same retarget phase?") a bit clearer, without complicating the BIP very much. It also might let the implementation follow the BIP pseudocode more exactly which might make it easier to see both are correct.

  8. ajtowns cross-referenced this on Oct 21, 2020 from issue Replace unused BIP 9 logic with draft BIP 8 by luke-jr
  9. in bip-0008.mediawiki:113 in 18b6e3618f
     119 |  
     120 |          case DEFINED:
     121 |              if (block.height >= startheight) {
     122 | -                return STARTED;
     123 | +                if (block.height >= timeoutheight) {
     124 | +                    return (lockinontimeout ? ACTIVE : FAILED);
    


    jonasnick commented at 8:31 PM on October 26, 2020:

    The genesis block handling is slightly better than before, but imo this is more difficult to understand than the current "timoutheight must be 2 retarget periods after startheight".

  10. ajtowns commented at 5:32 AM on October 27, 2020: contributor

    Closing this -- it only covers cases that can't reasonably arise in practice on either mainnet or testnet, and can be treated as an implementation detail elsewhere.

  11. ajtowns closed this on Oct 27, 2020


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bips. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-14 11:10 UTC

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