aboutsummaryrefslogtreecommitdiff
path: root/src/chain.h
diff options
context:
space:
mode:
authorJon Atack <jon@atack.com>2021-09-09 17:17:39 +0200
committerJon Atack <jon@atack.com>2022-01-25 20:43:12 +0100
commit6fd4341c10b319399c58d71c4ddeae4417e337d7 (patch)
tree0fce39f92baaeede34c7f6ef7e0111fc435b73b8 /src/chain.h
parent39d9bbe4acd7441aa9a61c57b76d887c4225a0e2 (diff)
Require CBlockIndex::GetBlockPos() to hold mutex cs_main
Diffstat (limited to 'src/chain.h')
-rw-r--r--src/chain.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/chain.h b/src/chain.h
index 55bdf4cd56..534f226f28 100644
--- a/src/chain.h
+++ b/src/chain.h
@@ -10,6 +10,7 @@
#include <consensus/params.h>
#include <flatfile.h>
#include <primitives/block.h>
+#include <sync.h>
#include <tinyformat.h>
#include <uint256.h>
@@ -37,6 +38,8 @@ static constexpr int64_t TIMESTAMP_WINDOW = MAX_FUTURE_BLOCK_TIME;
*/
static constexpr int64_t MAX_BLOCK_TIME_GAP = 90 * 60;
+extern RecursiveMutex cs_main;
+
class CBlockFileInfo
{
public:
@@ -223,8 +226,9 @@ public:
{
}
- FlatFilePos GetBlockPos() const
+ FlatFilePos GetBlockPos() const EXCLUSIVE_LOCKS_REQUIRED(::cs_main)
{
+ AssertLockHeld(::cs_main);
FlatFilePos ret;
if (nStatus & BLOCK_HAVE_DATA) {
ret.nFile = nFile;