HomePhabricator

Properly track the "best" invalid tip

Description

Properly track the "best" invalid tip

Summary:
As it turn out, some code path do select the best block that's actually invalid, not it's child with the most proof of work.

To fix that problem, we delegate the responsability of finding such block to FindMostWorkChain and remove them from the candidate list.

Test Plan:

make check
./src/bitcoind -regtest -printtoconsole
./src/bitcoin-cli generate 100
./src/bitcoin-cli invalidateblock <block hash that is 6+ block deep>

Check that the node warn about a large invalid chain being present.

Depends on D1942

Reviewers: #bitcoin_abc, jasonbcox

Reviewed By: #bitcoin_abc, jasonbcox

Subscribers: teamcity

Differential Revision: https://reviews.bitcoinabc.org/D1947

Details

Provenance
deadalnixAuthored on Oct 20 2018, 14:46
deadalnixPushed on Oct 20 2018, 19:45
Reviewer
Restricted Project
Differential Revision
D1947: Properly track the "best" invalid tip
Parents
rSTAGINGce0a84c66a91: Track the best parked chain tip.
Branches
Unknown
Tags
Unknown
References
tag: phabricator/base/5471