HomePhabricator

[diagnostic] perform more aggressive checking of the index during…

Description

[diagnostic] perform more aggressive checking of the index during ActivateBestChain

Summary:
This Diff moves the CheckBlockIndex call to just outside of the inner
loop, instead of having it run only after the outer loop is done (and even
then, only if the function was not returned from).

This ensures the block index is in perfect condition every time cs_main
is unlocked, since it gets unlocked during every iteration of the
outer loop. This helps catch bad block index states as soon as they happen,
rather than having them only show up as race conditions (like we
were seeing in rare validation_block_tests failures).

Note that CheckBlockIndex only performs checks on regtest by default,
so this change will cause no impact to mainnet/testnet nodes. For regular
chain behaviour, there is no performance impact here since typically
ActivateBestChain will just do one iteration anyway.

Test Plan:

make check
test_runner.py

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

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

Details

Provenance
Mark Lundeberg <markblundeberg@users.noreply.github.com>Authored on Dec 13 2019, 04:51
markblundebergPushed on Dec 23 2019, 02:05
Reviewer
Restricted Project
Differential Revision
Restricted Differential Revision
Parents
rABC25f189b9aac0: Merge #15101: gui: Add WalletController
Branches
Unknown
Tags
Unknown

Event Timeline

Mark Lundeberg <markblundeberg@users.noreply.github.com> committed rABC90999a3993c4: [diagnostic] perform more aggressive checking of the index during… (authored by Mark Lundeberg <markblundeberg@users.noreply.github.com>).Dec 23 2019, 02:05
Mark Lundeberg <markblundeberg@users.noreply.github.com> added an edge: Restricted Differential Revision.