diff options
| author | Matt Corallo <[email protected]> | 2017-12-04 18:25:57 -0500 |
|---|---|---|
| committer | Matt Corallo <[email protected]> | 2017-12-26 11:54:43 -0500 |
| commit | a99b76f26958829c2b9ca4ffa5b1d81912b8acc7 (patch) | |
| tree | e8d58aa97befc795ca199e105ae0a5bec5a70535 /src/validation.cpp | |
| parent | Avoid cs_main in net_processing ActivateBestChain calls (diff) | |
| download | discoin-a99b76f26958829c2b9ca4ffa5b1d81912b8acc7.tar.xz discoin-a99b76f26958829c2b9ca4ffa5b1d81912b8acc7.zip | |
Require no cs_main lock for ProcessNewBlock/ActivateBestChain
This requires the removal of some very liberal (incorrect) cs_mains
sprinkled in some tests. It adds some chainActive.Tip() races, but
the tests are all single-threaded anyway.
Diffstat (limited to 'src/validation.cpp')
| -rw-r--r-- | src/validation.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/validation.cpp b/src/validation.cpp index 75c40b22f..71a51c499 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2559,6 +2559,7 @@ bool CChainState::ActivateBestChain(CValidationState &state, const CChainParams& // far from a guarantee. Things in the P2P/RPC will often end up calling // us in the middle of ProcessNewBlock - do not assume pblock is set // sanely for performance or correctness! + AssertLockNotHeld(cs_main); CBlockIndex *pindexMostWork = nullptr; CBlockIndex *pindexNewTip = nullptr; @@ -3383,6 +3384,8 @@ bool CChainState::AcceptBlock(const std::shared_ptr<const CBlock>& pblock, CVali bool ProcessNewBlock(const CChainParams& chainparams, const std::shared_ptr<const CBlock> pblock, bool fForceProcessing, bool *fNewBlock) { + AssertLockNotHeld(cs_main); + { CBlockIndex *pindex = nullptr; if (fNewBlock) *fNewBlock = false; |