MCPcopy Create free account
hub / github.com/ElementsProject/elements / getmempoolentry

Function getmempoolentry

src/rpc/blockchain.cpp:842–873  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

840}
841
842static 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
875static RPCHelpMan getblockfrompeer()
876{

Callers

nothing calls this directly

Calls 7

MempoolEntryDescriptionFunction · 0.85
HelpExampleCliFunction · 0.85
HelpExampleRpcFunction · 0.85
ParseHashVFunction · 0.85
JSONRPCErrorFunction · 0.85
findMethod · 0.80
endMethod · 0.45

Tested by

no test coverage detected