aboutsummaryrefslogtreecommitdiff
path: root/src/validation.h
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.h
parent33707a2a8828c68e3c0586bdadea52c84873d386 (diff)
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.h')
-rw-r--r--src/validation.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/validation.h b/src/validation.h
index b80fa9d328..ef48156309 100644
--- a/src/validation.h
+++ b/src/validation.h
@@ -558,9 +558,8 @@ protected:
* Every received block is assigned a unique and increasing identifier, so we
* know which one to give priority in case of a fork.
*/
- RecursiveMutex cs_nBlockSequenceId;
/** Blocks loaded from disk are assigned id 0, so start the counter at 1. */
- int32_t nBlockSequenceId = 1;
+ int32_t nBlockSequenceId GUARDED_BY(::cs_main) = 1;
/** Decreasing counter (used by subsequent preciousblock calls). */
int32_t nBlockReverseSequenceId = -1;
/** chainwork for the last block that preciousblock has been applied to. */
@@ -749,7 +748,7 @@ public:
void PruneBlockIndexCandidates();
- void UnloadBlockIndex();
+ void UnloadBlockIndex() EXCLUSIVE_LOCKS_REQUIRED(::cs_main);
/** Check whether we are doing an initial block download (synchronizing from disk or network) */
bool IsInitialBlockDownload() const;