Skip to content

Commit fad4c89

Browse files
author
MarcoFalke
committed
Add RegisterMempoolRPCCommands helper
1 parent fafd40b commit fad4c89

File tree

3 files changed

+20
-13
lines changed

3 files changed

+20
-13
lines changed

src/rpc/blockchain.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2378,13 +2378,6 @@ UniValue CreateUTXOSnapshot(
23782378
}
23792379

23802380

2381-
RPCHelpMan getmempoolancestors();
2382-
RPCHelpMan getmempooldescendants();
2383-
RPCHelpMan getmempoolentry();
2384-
RPCHelpMan getmempoolinfo();
2385-
RPCHelpMan getrawmempool();
2386-
RPCHelpMan savemempool();
2387-
23882381
void RegisterBlockchainRPCCommands(CRPCTable &t)
23892382
{
23902383
// clang-format off
@@ -2403,15 +2396,9 @@ static const CRPCCommand commands[] =
24032396
{ "blockchain", &getchaintips, },
24042397
{ "blockchain", &getdifficulty, },
24052398
{ "blockchain", &getdeploymentinfo, },
2406-
{ "blockchain", &getmempoolancestors, },
2407-
{ "blockchain", &getmempooldescendants, },
2408-
{ "blockchain", &getmempoolentry, },
2409-
{ "blockchain", &getmempoolinfo, },
2410-
{ "blockchain", &getrawmempool, },
24112399
{ "blockchain", &gettxout, },
24122400
{ "blockchain", &gettxoutsetinfo, },
24132401
{ "blockchain", &pruneblockchain, },
2414-
{ "blockchain", &savemempool, },
24152402
{ "blockchain", &verifychain, },
24162403

24172404
{ "blockchain", &preciousblock, },

src/rpc/mempool.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,3 +457,20 @@ RPCHelpMan savemempool()
457457
},
458458
};
459459
}
460+
461+
void RegisterMempoolRPCCommands(CRPCTable& t)
462+
{
463+
static const CRPCCommand commands[]{
464+
// category actor (function)
465+
// -------- ----------------
466+
{"blockchain", &getmempoolancestors},
467+
{"blockchain", &getmempooldescendants},
468+
{"blockchain", &getmempoolentry},
469+
{"blockchain", &getmempoolinfo},
470+
{"blockchain", &getrawmempool},
471+
{"blockchain", &savemempool},
472+
};
473+
for (const auto& c : commands) {
474+
t.appendCommand(c.name, &c);
475+
}
476+
}

src/rpc/register.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ class CRPCTable;
1111

1212
/** Register block chain RPC commands */
1313
void RegisterBlockchainRPCCommands(CRPCTable &tableRPC);
14+
/** Register mempool RPC commands */
15+
void RegisterMempoolRPCCommands(CRPCTable&);
1416
/** Register P2P networking RPC commands */
1517
void RegisterNetRPCCommands(CRPCTable &tableRPC);
1618
/** Register miscellaneous RPC commands */
@@ -25,6 +27,7 @@ void RegisterSignerRPCCommands(CRPCTable &tableRPC);
2527
static inline void RegisterAllCoreRPCCommands(CRPCTable &t)
2628
{
2729
RegisterBlockchainRPCCommands(t);
30+
RegisterMempoolRPCCommands(t);
2831
RegisterNetRPCCommands(t);
2932
RegisterMiscRPCCommands(t);
3033
RegisterMiningRPCCommands(t);

0 commit comments

Comments
 (0)