| 641 | } |
| 642 | |
| 643 | static UniValue getmempoolentry(const JSONRPCRequest& request) |
| 644 | { |
| 645 | if (request.fHelp || request.params.size() != 1) { |
| 646 | throw std::runtime_error( |
| 647 | "getmempoolentry txid\n" |
| 648 | "\nReturns mempool data for given transaction\n" |
| 649 | "\nArguments:\n" |
| 650 | "1. \"txid\" (string, required) The transaction id (must be in mempool)\n" |
| 651 | "\nResult:\n" |
| 652 | "{ (json object)\n" |
| 653 | + EntryDescriptionString() |
| 654 | + "}\n" |
| 655 | "\nExamples:\n" |
| 656 | + HelpExampleCli("getmempoolentry", "\"mytxid\"") |
| 657 | + HelpExampleRpc("getmempoolentry", "\"mytxid\"") |
| 658 | ); |
| 659 | } |
| 660 | |
| 661 | uint256 hash = ParseHashV(request.params[0], "parameter 1"); |
| 662 | |
| 663 | LOCK(mempool.cs); |
| 664 | |
| 665 | CTxMemPool::txiter it = mempool.mapTx.find(hash); |
| 666 | if (it == mempool.mapTx.end()) { |
| 667 | throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Transaction not in mempool"); |
| 668 | } |
| 669 | |
| 670 | const CTxMemPoolEntry &e = *it; |
| 671 | UniValue info(UniValue::VOBJ); |
| 672 | entryToJSON(info, e); |
| 673 | return info; |
| 674 | } |
| 675 | |
| 676 | static UniValue getblockhash(const JSONRPCRequest& request) |
| 677 | { |
nothing calls this directly
no test coverage detected