| 840 | } |
| 841 | |
| 842 | static RPCHelpMan getmempoolentry() |
| 843 | { |
| 844 | return RPCHelpMan{"getmempoolentry", |
| 845 | "\nReturns mempool data for given transaction\n", |
| 846 | { |
| 847 | {"txid", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The transaction id (must be in mempool)"}, |
| 848 | }, |
| 849 | RPCResult{ |
| 850 | RPCResult::Type::OBJ, "", "", MempoolEntryDescription()}, |
| 851 | RPCExamples{ |
| 852 | HelpExampleCli("getmempoolentry", "\"mytxid\"") |
| 853 | + HelpExampleRpc("getmempoolentry", "\"mytxid\"") |
| 854 | }, |
| 855 | [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue |
| 856 | { |
| 857 | uint256 hash = ParseHashV(request.params[0], "parameter 1"); |
| 858 | |
| 859 | const CTxMemPool& mempool = EnsureAnyMemPool(request.context); |
| 860 | LOCK(mempool.cs); |
| 861 | |
| 862 | CTxMemPool::txiter it = mempool.mapTx.find(hash); |
| 863 | if (it == mempool.mapTx.end()) { |
| 864 | throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Transaction not in mempool"); |
| 865 | } |
| 866 | |
| 867 | const CTxMemPoolEntry &e = *it; |
| 868 | UniValue info(UniValue::VOBJ); |
| 869 | entryToJSON(mempool, info, e); |
| 870 | return info; |
| 871 | }, |
| 872 | }; |
| 873 | } |
| 874 | |
| 875 | static RPCHelpMan getblockfrompeer() |
| 876 | { |
nothing calls this directly
no test coverage detected