diff options
author | fanquake <fanquake@gmail.com> | 2022-09-15 10:45:07 +0100 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2023-01-05 09:05:14 +0000 |
commit | 282019cd3ddb060db350654e6f855f7ea37e0d34 (patch) | |
tree | 0d4cf47437572b3d80a6275392d291701ec14f3f /src/kernel | |
parent | 296e88225096125b08665b97715c5b8ebb1d28ec (diff) |
refactor: add kernel/cs_main.*
Co-authored-by: Anthony Towns <aj@erisian.com.au>
Diffstat (limited to 'src/kernel')
-rw-r--r-- | src/kernel/cs_main.cpp | 7 | ||||
-rw-r--r-- | src/kernel/cs_main.h | 22 |
2 files changed, 29 insertions, 0 deletions
diff --git a/src/kernel/cs_main.cpp b/src/kernel/cs_main.cpp new file mode 100644 index 0000000000..c3a08c9695 --- /dev/null +++ b/src/kernel/cs_main.cpp @@ -0,0 +1,7 @@ +// Copyright (c) 2023 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include <sync.h> + +RecursiveMutex cs_main; diff --git a/src/kernel/cs_main.h b/src/kernel/cs_main.h new file mode 100644 index 0000000000..8d03903b8e --- /dev/null +++ b/src/kernel/cs_main.h @@ -0,0 +1,22 @@ +// Copyright (c) 2023 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#ifndef BITCOIN_KERNEL_CS_MAIN_H +#define BITCOIN_KERNEL_CS_MAIN_H + +#include <sync.h> + +/** + * Mutex to guard access to validation specific variables, such as reading + * or changing the chainstate. + * + * This may also need to be locked when updating the transaction pool, e.g. on + * AcceptToMemoryPool. See CTxMemPool::cs comment for details. + * + * The transaction pool has a separate lock to allow reading from it and the + * chainstate at the same time. + */ +extern RecursiveMutex cs_main; + +#endif // BITCOIN_KERNEL_CS_MAIN_H |