aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/blockchain.cpp
diff options
context:
space:
mode:
authorCarl Dong <contact@carldong.me>2021-04-14 10:16:34 -0400
committerCarl Dong <contact@carldong.me>2021-04-14 10:54:27 -0400
commit1570c7ee98612366df031bebef9e0468fb57b8a2 (patch)
tree718ecb8d1335ff9730159d4f7de1aab8b02fb468 /src/rpc/blockchain.cpp
parent306b1cd3eeb2502904ed4698646d2c86d028aad2 (diff)
downloadbitcoin-1570c7ee98612366df031bebef9e0468fb57b8a2.tar.xz
rpc: Add renamed EnsureAny*() functions
- The original Ensure*(const std::any& context) functions are kept and the parameter renamed to ctx so that the scripted-diff in the subsequent commit will work as expected - The renaming avoids overloading mistakes arising out of the untyped std::any argument.
Diffstat (limited to 'src/rpc/blockchain.cpp')
-rw-r--r--src/rpc/blockchain.cpp24
1 files changed, 20 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));
}