HomePhabricator

Fix concurrency-related bugs in ActivateBestChain

Description

Fix concurrency-related bugs in ActivateBestChain

Summary:
If multiple threads are invoking ActivateBestChain, it was possible to have
them working towards different tips, and we could arrive at a less work tip
than we should. Fix this by introducing a ChainState lock which must
be held for the entire duration of ActivateBestChain to enforce
exclusion in ABC.

This is a partial backport of Core PR13023 : https://github.com/bitcoin/bitcoin/pull/13023/commits/a3ae8e68739023e5dba9e5cb190e707ed4603316

Depends on D3435

Test Plan:

make check

Reviewers: #bitcoin_abc, jasonbcox

Reviewed By: #bitcoin_abc, jasonbcox

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

Details

Provenance
Jesse Cohen <jc@jc.lol>Authored on May 10 2018, 19:57
deadalnixCommitted on Jun 29 2019, 21:16
deadalnixPushed on Jun 29 2019, 21:16
Reviewer
Restricted Project
Differential Revision
D3436: Fix concurrency-related bugs in ActivateBestChain
Parents
rABC43b15a49cbf0: [LINTER] Enforce flake8 W605 warning
Branches
Unknown
Tags
Unknown