HomePhabricator

Merge #11578: net: Add missing lock in ProcessHeadersMessage(...)

Description

Merge #11578: net: Add missing lock in ProcessHeadersMessage(...)

Summary:
2530bf2 net: Add missing lock in ProcessHeadersMessage(...) (practicalswift)

Pull request description:

Add missing lock in `ProcessHeadersMessage(...)`.

Reading the variable `mapBlockIndex` requires holding the mutex `cs_main`.

The new "Disconnect outbound peers relaying invalid headers" code added in commit 37886d5e2f9992678dea4b1bd893f4f10d61d3ad and merged as part of #11568 two days ago did not lock `cs_main` prior to accessing `mapBlockIndex`.

Tree-SHA512: b799c234be8043d036183a00bc7867bbf3bd7ffe3baa94c88529da3b3cd0571c31ed11dadfaf29c5b8498341d6d0a3c928029a43b69f3267ef263682c91563a3

Backport of Core PR11578
https://github.com/bitcoin/bitcoin/pull/11578/files

Test Plan:
ninja check
make check
test_runner.py
bitcoind # sanity check

Reviewers: deadalnix, Fabien, #bitcoin_abc

Reviewed By: Fabien, #bitcoin_abc

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

Details

Provenance
Wladimir J. van der Laan <laanwj@gmail.com>Authored on Oct 31 2017, 12:10
jasonbcoxCommitted on May 9 2019, 16:20
jasonbcoxPushed on May 9 2019, 16:47
Reviewer
Restricted Project
Differential Revision
D2890: Merge #11578: net: Add missing lock in ProcessHeadersMessage(...)
Parents
rSTAGING3d89108fd70a: Merge #10309: Trivial: remove extra character from comment
Branches
Unknown
Tags
Unknown