@@ -64,34 +64,46 @@ NodeContext& EnsureNodeContext(const std::any& context)
64
64
return *node_context;
65
65
}
66
66
67
- CTxMemPool& EnsureMemPool (const std::any& context )
67
+ CTxMemPool& EnsureMemPool (const NodeContext& node )
68
68
{
69
- const NodeContext& node = EnsureNodeContext (context);
70
69
if (!node.mempool ) {
71
70
throw JSONRPCError (RPC_CLIENT_MEMPOOL_DISABLED, " Mempool disabled or instance not found" );
72
71
}
73
72
return *node.mempool ;
74
73
}
75
74
76
- ChainstateManager& EnsureChainman (const std::any& context)
75
+ CTxMemPool& EnsureMemPool (const std::any& context)
76
+ {
77
+ return EnsureMemPool (EnsureNodeContext (context));
78
+ }
79
+
80
+ ChainstateManager& EnsureChainman (const NodeContext& node)
77
81
{
78
- const NodeContext& node = EnsureNodeContext (context);
79
82
if (!node.chainman ) {
80
83
throw JSONRPCError (RPC_INTERNAL_ERROR, " Node chainman not found" );
81
84
}
82
85
WITH_LOCK (::cs_main, CHECK_NONFATAL (std::addressof (g_chainman) == std::addressof (*node.chainman )));
83
86
return *node.chainman ;
84
87
}
85
88
86
- CBlockPolicyEstimator& EnsureFeeEstimator (const std::any& context)
89
+ ChainstateManager& EnsureChainman (const std::any& context)
90
+ {
91
+ return EnsureChainman (EnsureNodeContext (context));
92
+ }
93
+
94
+ CBlockPolicyEstimator& EnsureFeeEstimator (const NodeContext& node)
87
95
{
88
- NodeContext& node = EnsureNodeContext (context);
89
96
if (!node.fee_estimator ) {
90
97
throw JSONRPCError (RPC_INTERNAL_ERROR, " Fee estimation disabled" );
91
98
}
92
99
return *node.fee_estimator ;
93
100
}
94
101
102
+ CBlockPolicyEstimator& EnsureFeeEstimator (const std::any& context)
103
+ {
104
+ return EnsureFeeEstimator (EnsureNodeContext (context));
105
+ }
106
+
95
107
/* Calculate the difficulty for a given block index.
96
108
*/
97
109
double GetDifficulty (const CBlockIndex* blockindex)
0 commit comments