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_nodemight go away is adding astd::any contextmember toJSONRPCRequestassigned to the node context, and having functions likeEnsureMempooltakerequestarguments and pull the context from the request.