aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rpc/blockchain.cpp24
-rw-r--r--src/rpc/blockchain.h4
2 files changed, 24 insertions, 4 deletions
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp
index cc7a29ffdb..074f3e3924 100644
--- a/src/rpc/blockchain.cpp
+++ b/src/rpc/blockchain.cpp
@@ -55,7 +55,11 @@ static Mutex cs_blockchange;
static std::condition_variable cond_blockchange;
static CUpdatedBlock latestblock GUARDED_BY(cs_blockchange);
-NodeContext& EnsureNodeContext(const std::any& context)
+NodeContext& EnsureNodeContext(const std::any& ctx) {
+ return EnsureAnyNodeContext(ctx);
+}
+
+NodeContext& EnsureAnyNodeContext(const std::any& context)
{
auto node_context = util::AnyPtr<NodeContext>(context);
if (!node_context) {
@@ -64,6 +68,10 @@ NodeContext& EnsureNodeContext(const std::any& context)
return *node_context;
}
+CTxMemPool& EnsureMemPool(const std::any& ctx) {
+ return EnsureAnyMemPool(ctx);
+}
+
CTxMemPool& EnsureMemPool(const NodeContext& node)
{
if (!node.mempool) {
@@ -72,11 +80,15 @@ CTxMemPool& EnsureMemPool(const NodeContext& node)
return *node.mempool;
}
-CTxMemPool& EnsureMemPool(const std::any& context)
+CTxMemPool& EnsureAnyMemPool(const std::any& context)
{
return EnsureMemPool(EnsureNodeContext(context));
}
+ChainstateManager& EnsureChainman(const std::any& ctx) {
+ return EnsureAnyChainman(ctx);
+}
+
ChainstateManager& EnsureChainman(const NodeContext& node)
{
if (!node.chainman) {
@@ -86,11 +98,15 @@ ChainstateManager& EnsureChainman(const NodeContext& node)
return *node.chainman;
}
-ChainstateManager& EnsureChainman(const std::any& context)
+ChainstateManager& EnsureAnyChainman(const std::any& context)
{
return EnsureChainman(EnsureNodeContext(context));
}
+CBlockPolicyEstimator& EnsureFeeEstimator(const std::any& ctx) {
+ return EnsureAnyFeeEstimator(ctx);
+}
+
CBlockPolicyEstimator& EnsureFeeEstimator(const NodeContext& node)
{
if (!node.fee_estimator) {
@@ -99,7 +115,7 @@ CBlockPolicyEstimator& EnsureFeeEstimator(const NodeContext& node)
return *node.fee_estimator;
}
-CBlockPolicyEstimator& EnsureFeeEstimator(const std::any& context)
+CBlockPolicyEstimator& EnsureAnyFeeEstimator(const std::any& context)
{
return EnsureFeeEstimator(EnsureNodeContext(context));
}
diff --git a/src/rpc/blockchain.h b/src/rpc/blockchain.h
index 17c7060761..3ac15c869d 100644
--- a/src/rpc/blockchain.h
+++ b/src/rpc/blockchain.h
@@ -57,12 +57,16 @@ void ScriptPubKeyToUniv(const CScript& scriptPubKey, UniValue& out, bool fInclud
void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry, bool include_hex = true, int serialize_flags = 0, const CTxUndo* txundo = nullptr);
NodeContext& EnsureNodeContext(const std::any& context);
+NodeContext& EnsureAnyNodeContext(const std::any& context);
CTxMemPool& EnsureMemPool(const NodeContext& node);
CTxMemPool& EnsureMemPool(const std::any& context);
+CTxMemPool& EnsureAnyMemPool(const std::any& context);
ChainstateManager& EnsureChainman(const NodeContext& node);
ChainstateManager& EnsureChainman(const std::any& context);
+ChainstateManager& EnsureAnyChainman(const std::any& context);
CBlockPolicyEstimator& EnsureFeeEstimator(const NodeContext& node);
CBlockPolicyEstimator& EnsureFeeEstimator(const std::any& context);
+CBlockPolicyEstimator& EnsureAnyFeeEstimator(const std::any& context);
/**
* Helper to create UTXO snapshots given a chainstate and a file handle.