Reject headers that build on an invalid parent #5459

pull sipa wants to merge 1 commits into bitcoin:master from sipa:rejheader changing 1 files +6 −0
  1. sipa commented at 12:36 PM on December 11, 2014: member

    Noticed by @gmaxwell: a node keeps downloading blocks after a local error that caused it to treat one block as invalid.

    NOT tested.

  2. laanwj added the label P2P on Dec 12, 2014
  3. laanwj added this to the milestone 0.10.0 on Dec 19, 2014
  4. laanwj commented at 12:39 PM on December 22, 2014: member

    After having applied this I've rigged my bitcoind to fail at block 10000, with

    diff --git a/src/main.cpp b/src/main.cpp
    index 235d3e6..2a9f20b 100644
    --- a/src/main.cpp
    +++ b/src/main.cpp
    @@ -1960,6 +1961,11 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *
             CInv inv(MSG_BLOCK, pindexNew->GetBlockHash());
             bool rv = ConnectBlock(*pblock, state, pindexNew, view);
             g_signals.BlockChecked(*pblock, state);
    +        if (chainActive.Height() == 10000)
    +        {
    +            rv = false;
    +            state.Invalid(error("height == 10000"));
    +        }
             if (!rv) {
                 if (state.IsInvalid())
                     InvalidBlockFound(pindexNew, state);
    

    But it keeps downloading: see http://www.hastebin.com/retodasuje.txt for debug.log extract.

  5. Reject headers that build on an invalid parent 3497022347
  6. sipa force-pushed on Dec 22, 2014
  7. sipa commented at 2:16 PM on December 22, 2014: member

    Updated, and tested with your patch.

    It still tries to connect the same block over and over again, but that's because the validated doesn't actually mark it as invalid.

  8. laanwj commented at 2:29 PM on December 22, 2014: member

    Tested ACK

  9. gmaxwell commented at 10:29 AM on December 23, 2014: contributor

    ACK

  10. laanwj merged this on Dec 23, 2014
  11. laanwj closed this on Dec 23, 2014

  12. laanwj referenced this in commit 4406c3e0f4 on Dec 23, 2014
  13. maaku commented at 10:54 AM on December 23, 2014: contributor

    ACK (tested)

  14. sipa referenced this in commit 8446262597 on Dec 23, 2014
  15. MarcoFalke locked this on Sep 8, 2021
Labels

Milestone
0.10.0


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

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