mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
refactor: use monostate instead std::optional in CoreContext
This commit is contained in:
parent
1394c41c8d
commit
37bd4009c1
@ -5,8 +5,8 @@
|
||||
#ifndef BITCOIN_CONTEXT_H
|
||||
#define BITCOIN_CONTEXT_H
|
||||
|
||||
#include <functional>
|
||||
#include <variant>
|
||||
#include <optional>
|
||||
|
||||
class ChainstateManager;
|
||||
class CTxMemPool;
|
||||
@ -15,7 +15,7 @@ struct LLMQContext;
|
||||
struct NodeContext;
|
||||
struct WalletContext;
|
||||
|
||||
using CoreContext = std::variant<std::nullopt_t,
|
||||
using CoreContext = std::variant<std::monostate,
|
||||
std::reference_wrapper<NodeContext>,
|
||||
std::reference_wrapper<WalletContext>,
|
||||
std::reference_wrapper<CTxMemPool>,
|
||||
|
@ -67,6 +67,7 @@
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <utility>
|
||||
#include <variant>
|
||||
|
||||
using interfaces::BlockTip;
|
||||
using interfaces::Chain;
|
||||
@ -584,11 +585,11 @@ public:
|
||||
if (context) {
|
||||
m_context_ref = *context;
|
||||
} else {
|
||||
m_context_ref = std::nullopt;
|
||||
m_context_ref = std::monostate{};
|
||||
}
|
||||
}
|
||||
NodeContext* m_context{nullptr};
|
||||
CoreContext m_context_ref{std::nullopt};
|
||||
CoreContext m_context_ref;
|
||||
};
|
||||
|
||||
bool FillBlock(const CBlockIndex* index, const FoundBlock& block, UniqueLock<RecursiveMutex>& lock, const CChain& active)
|
||||
|
Loading…
Reference in New Issue
Block a user