aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/blockchain.cpp
diff options
context:
space:
mode:
authorSebastian Falbesoner <sebastian.falbesoner@gmail.com>2020-12-01 00:36:36 +0100
committerSebastian Falbesoner <sebastian.falbesoner@gmail.com>2021-03-29 23:29:42 +0200
commit8dbb87a3932f81e23ba7afd865b9aeeb535f0c20 (patch)
tree2b1376e9bb8f6792946c6fabdffdc6a5a73fd8d2 /src/rpc/blockchain.cpp
parent95cccf8a4b392959c1fd7ec0647e04eb13880865 (diff)
downloadbitcoin-8dbb87a3932f81e23ba7afd865b9aeeb535f0c20.tar.xz
refactor: replace util::Ref by std::any (C++17)
Diffstat (limited to 'src/rpc/blockchain.cpp')
-rw-r--r--src/rpc/blockchain.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp
index f0ad141fa9..961478155f 100644
--- a/src/rpc/blockchain.cpp
+++ b/src/rpc/blockchain.cpp
@@ -30,7 +30,6 @@
#include <txdb.h>
#include <txmempool.h>
#include <undo.h>
-#include <util/ref.h>
#include <util/strencodings.h>
#include <util/system.h>
#include <util/translation.h>
@@ -56,15 +55,16 @@ static Mutex cs_blockchange;
static std::condition_variable cond_blockchange;
static CUpdatedBlock latestblock GUARDED_BY(cs_blockchange);
-NodeContext& EnsureNodeContext(const util::Ref& context)
+NodeContext& EnsureNodeContext(const std::any& context)
{
- if (!context.Has<NodeContext>()) {
+ auto node_context = util::AnyPtr<NodeContext>(context);
+ if (!node_context) {
throw JSONRPCError(RPC_INTERNAL_ERROR, "Node context not found");
}
- return context.Get<NodeContext>();
+ return *node_context;
}
-CTxMemPool& EnsureMemPool(const util::Ref& context)
+CTxMemPool& EnsureMemPool(const std::any& context)
{
const NodeContext& node = EnsureNodeContext(context);
if (!node.mempool) {
@@ -73,7 +73,7 @@ CTxMemPool& EnsureMemPool(const util::Ref& context)
return *node.mempool;
}
-ChainstateManager& EnsureChainman(const util::Ref& context)
+ChainstateManager& EnsureChainman(const std::any& context)
{
const NodeContext& node = EnsureNodeContext(context);
if (!node.chainman) {
@@ -82,7 +82,7 @@ ChainstateManager& EnsureChainman(const util::Ref& context)
return *node.chainman;
}
-CBlockPolicyEstimator& EnsureFeeEstimator(const util::Ref& context)
+CBlockPolicyEstimator& EnsureFeeEstimator(const std::any& context)
{
NodeContext& node = EnsureNodeContext(context);
if (!node.fee_estimator) {