aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2022-03-15 19:31:10 +0100
committerMarcoFalke <falke.marco@gmail.com>2022-03-15 19:29:59 +0100
commitfad4c8934c7b4342076bd01daa4abf4d83617b17 (patch)
tree937d12dce509b7a7afa5700444fc310f405f2b12 /src/rpc
parentfafd40b5413aea5f8ec47c24fdb2ccc702e7cdd7 (diff)
Add RegisterMempoolRPCCommands helper
Diffstat (limited to 'src/rpc')
-rw-r--r--src/rpc/blockchain.cpp13
-rw-r--r--src/rpc/mempool.cpp17
-rw-r--r--src/rpc/register.h3
3 files changed, 20 insertions, 13 deletions
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp
index fec7c8f27f..bb88ea9011 100644
--- a/src/rpc/blockchain.cpp
+++ b/src/rpc/blockchain.cpp
@@ -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, },
diff --git a/src/rpc/mempool.cpp b/src/rpc/mempool.cpp
index 34b89f33ca..bc7ef0c08e 100644
--- a/src/rpc/mempool.cpp
+++ b/src/rpc/mempool.cpp
@@ -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);
+ }
+}
diff --git a/src/rpc/register.h b/src/rpc/register.h
index c5055cc9d7..cc3a5e0a63 100644
--- a/src/rpc/register.h
+++ b/src/rpc/register.h
@@ -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);