g_rpc_node
is an alias for the current node context. It would be nice to pass in the node context into each rpc method somehow and remove the g_rpc_node global.
Not sure how to do this, but here is a hint: #17407 (review)
One way
g_rpc_node
might go away is adding astd::any context
member toJSONRPCRequest
assigned to the node context, and having functions likeEnsureMempool
takerequest
arguments and pull the context from the request.