Add RegisterMempoolRPCCommands helper

This commit is contained in:
MarcoFalke 2022-03-15 19:31:10 +01:00
parent fafd40b541
commit fad4c8934c
No known key found for this signature in database
GPG Key ID: CE2B75697E69A548
3 changed files with 20 additions and 13 deletions

View File

@ -2378,13 +2378,6 @@ UniValue CreateUTXOSnapshot(
}
RPCHelpMan getmempoolancestors();
RPCHelpMan getmempooldescendants();
RPCHelpMan getmempoolentry();
RPCHelpMan getmempoolinfo();
RPCHelpMan getrawmempool();
RPCHelpMan savemempool();
void RegisterBlockchainRPCCommands(CRPCTable &t)
{
// clang-format off
@ -2403,15 +2396,9 @@ static const CRPCCommand commands[] =
{ "blockchain", &getchaintips, },
{ "blockchain", &getdifficulty, },
{ "blockchain", &getdeploymentinfo, },
{ "blockchain", &getmempoolancestors, },
{ "blockchain", &getmempooldescendants, },
{ "blockchain", &getmempoolentry, },
{ "blockchain", &getmempoolinfo, },
{ "blockchain", &getrawmempool, },
{ "blockchain", &gettxout, },
{ "blockchain", &gettxoutsetinfo, },
{ "blockchain", &pruneblockchain, },
{ "blockchain", &savemempool, },
{ "blockchain", &verifychain, },
{ "blockchain", &preciousblock, },

View File

@ -457,3 +457,20 @@ RPCHelpMan savemempool()
},
};
}
void RegisterMempoolRPCCommands(CRPCTable& t)
{
static const CRPCCommand commands[]{
// category actor (function)
// -------- ----------------
{"blockchain", &getmempoolancestors},
{"blockchain", &getmempooldescendants},
{"blockchain", &getmempoolentry},
{"blockchain", &getmempoolinfo},
{"blockchain", &getrawmempool},
{"blockchain", &savemempool},
};
for (const auto& c : commands) {
t.appendCommand(c.name, &c);
}
}

View File

@ -11,6 +11,8 @@ class CRPCTable;
/** Register block chain RPC commands */
void RegisterBlockchainRPCCommands(CRPCTable &tableRPC);
/** Register mempool RPC commands */
void RegisterMempoolRPCCommands(CRPCTable&);
/** Register P2P networking RPC commands */
void RegisterNetRPCCommands(CRPCTable &tableRPC);
/** Register miscellaneous RPC commands */
@ -25,6 +27,7 @@ void RegisterSignerRPCCommands(CRPCTable &tableRPC);
static inline void RegisterAllCoreRPCCommands(CRPCTable &t)
{
RegisterBlockchainRPCCommands(t);
RegisterMempoolRPCCommands(t);
RegisterNetRPCCommands(t);
RegisterMiscRPCCommands(t);
RegisterMiningRPCCommands(t);