aboutsummaryrefslogtreecommitdiff
path: root/src/validation.cpp
diff options
context:
space:
mode:
authorSebastian Falbesoner <sebastian.falbesoner@gmail.com>2021-08-28 11:51:36 +0200
committerSebastian Falbesoner <sebastian.falbesoner@gmail.com>2021-08-29 13:31:00 +0200
commit0bd882b7405414b5355e69a9fdcd7a533e504b6b (patch)
tree6d92233604ced925614e70eebc05160a16e8f1ec /src/validation.cpp
parent33707a2a8828c68e3c0586bdadea52c84873d386 (diff)
downloadbitcoin-0bd882b7405414b5355e69a9fdcd7a533e504b6b.tar.xz
refactor: remove RecursiveMutex cs_nBlockSequenceId
The RecursiveMutex cs_nBlockSequenceId is only used at one place in CChainState::ReceivedBlockTransactions() to atomically read-and-increment the nBlockSequenceId member. At this point, the cs_main lock is set, hence we can use a plain int for the member and mark it as guarded by cs_main.
Diffstat (limited to 'src/validation.cpp')
-rw-r--r--src/validation.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index ec457da5cc..9944e31557 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -2970,10 +2970,7 @@ void CChainState::ReceivedBlockTransactions(const CBlock& block, CBlockIndex* pi
CBlockIndex *pindex = queue.front();
queue.pop_front();
pindex->nChainTx = (pindex->pprev ? pindex->pprev->nChainTx : 0) + pindex->nTx;
- {
- LOCK(cs_nBlockSequenceId);
- pindex->nSequenceId = nBlockSequenceId++;
- }
+ pindex->nSequenceId = nBlockSequenceId++;
if (m_chain.Tip() == nullptr || !setBlockIndexCandidates.value_comp()(pindex, m_chain.Tip())) {
setBlockIndexCandidates.insert(pindex);
}