| 843 | } |
| 844 | |
| 845 | static 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 | |
| 880 | static RPCMethod getmempoolentry() |
| 881 | { |
nothing calls this directly
no test coverage detected