| 666 | } |
| 667 | |
| 668 | static RPCMethod getrawmempool() |
| 669 | { |
| 670 | return RPCMethod{ |
| 671 | "getrawmempool", |
| 672 | "Returns all transaction ids in memory pool as a json array of string transaction ids.\n" |
| 673 | "\nHint: use getmempoolentry to fetch a specific transaction from the mempool.\n", |
| 674 | { |
| 675 | {"verbose", RPCArg::Type::BOOL, RPCArg::Default{false}, "True for a json object, false for array of transaction ids"}, |
| 676 | {"mempool_sequence", RPCArg::Type::BOOL, RPCArg::Default{false}, "If verbose=false, returns a json object with transaction list and mempool sequence number attached."}, |
| 677 | }, |
| 678 | { |
| 679 | RPCResult{"for verbose = false", |
| 680 | RPCResult::Type::ARR, "", "", |
| 681 | { |
| 682 | {RPCResult::Type::STR_HEX, "", "The transaction id"}, |
| 683 | }}, |
| 684 | RPCResult{"for verbose = true", |
| 685 | RPCResult::Type::OBJ_DYN, "", "", |
| 686 | { |
| 687 | {RPCResult::Type::OBJ, "transactionid", "", MempoolEntryDescription()}, |
| 688 | }}, |
| 689 | RPCResult{"for verbose = false and mempool_sequence = true", |
| 690 | RPCResult::Type::OBJ, "", "", |
| 691 | { |
| 692 | {RPCResult::Type::ARR, "txids", "", |
| 693 | { |
| 694 | {RPCResult::Type::STR_HEX, "", "The transaction id"}, |
| 695 | }}, |
| 696 | {RPCResult::Type::NUM, "mempool_sequence", "The mempool sequence value."}, |
| 697 | }}, |
| 698 | }, |
| 699 | RPCExamples{ |
| 700 | HelpExampleCli("getrawmempool", "true") |
| 701 | + HelpExampleRpc("getrawmempool", "true") |
| 702 | }, |
| 703 | [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue |
| 704 | { |
| 705 | bool fVerbose = false; |
| 706 | if (!request.params[0].isNull()) |
| 707 | fVerbose = request.params[0].get_bool(); |
| 708 | |
| 709 | bool include_mempool_sequence = false; |
| 710 | if (!request.params[1].isNull()) { |
| 711 | include_mempool_sequence = request.params[1].get_bool(); |
| 712 | } |
| 713 | |
| 714 | return MempoolToJSON(EnsureAnyMemPool(request.context), fVerbose, include_mempool_sequence); |
| 715 | }, |
| 716 | }; |
| 717 | } |
| 718 | |
| 719 | static RPCMethod getmempoolancestors() |
| 720 | { |
nothing calls this directly
no test coverage detected