MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / getmempoolcluster

Function getmempoolcluster

src/rpc/mempool.cpp:845–878  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

843}
844
845static RPCMethod getmempoolcluster()
846{
847 return RPCMethod{"getmempoolcluster",
848 "Returns mempool data for given cluster\n",
849 {
850 {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The txid of a transaction in the cluster"},
851 },
852 RPCResult{
853 RPCResult::Type::OBJ, "", "", ClusterDescription()},
854 RPCExamples{
855 HelpExampleCli("getmempoolcluster", "txid")
856 + HelpExampleRpc("getmempoolcluster", "txid")
857 },
858 [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue
859{
860 uint256 hash = ParseHashV(request.params[0], "txid");
861
862 const CTxMemPool& mempool = EnsureAnyMemPool(request.context);
863 LOCK(mempool.cs);
864
865 auto txid = Txid::FromUint256(hash);
866 const auto entry{mempool.GetEntry(txid)};
867 if (entry == nullptr) {
868 throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Transaction not in mempool");
869 }
870
871 auto cluster = mempool.GetCluster(txid);
872
873 UniValue info(UniValue::VOBJ);
874 clusterToJSON(mempool, info, cluster);
875 return info;
876},
877 };
878}
879
880static RPCMethod getmempoolentry()
881{

Callers

nothing calls this directly

Calls 7

ClusterDescriptionFunction · 0.85
HelpExampleCliFunction · 0.85
HelpExampleRpcFunction · 0.85
ParseHashVFunction · 0.85
JSONRPCErrorFunction · 0.85
GetClusterMethod · 0.80
GetEntryMethod · 0.45

Tested by

no test coverage detected