| 791 | } |
| 792 | |
| 793 | static RPCHelpMan getindexinfo() |
| 794 | { |
| 795 | return RPCHelpMan{"getindexinfo", |
| 796 | "\nReturns the status of one or all available indices currently running in the node.\n", |
| 797 | { |
| 798 | {"index_name", RPCArg::Type::STR, RPCArg::Optional::OMITTED_NAMED_ARG, "Filter results for an index with a specific name."}, |
| 799 | }, |
| 800 | RPCResult{ |
| 801 | RPCResult::Type::OBJ_DYN, "", "", { |
| 802 | { |
| 803 | RPCResult::Type::OBJ, "name", "The name of the index", |
| 804 | { |
| 805 | {RPCResult::Type::BOOL, "synced", "Whether the index is synced or not"}, |
| 806 | {RPCResult::Type::NUM, "best_block_height", "The block height to which the index is synced"}, |
| 807 | } |
| 808 | }, |
| 809 | }, |
| 810 | }, |
| 811 | RPCExamples{ |
| 812 | HelpExampleCli("getindexinfo", "") |
| 813 | + HelpExampleRpc("getindexinfo", "") |
| 814 | + HelpExampleCli("getindexinfo", "txindex") |
| 815 | + HelpExampleRpc("getindexinfo", "txindex") |
| 816 | }, |
| 817 | [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue |
| 818 | { |
| 819 | UniValue result(UniValue::VOBJ); |
| 820 | const std::string index_name = request.params[0].isNull() ? "" : request.params[0].get_str(); |
| 821 | |
| 822 | if (g_txindex) { |
| 823 | result.pushKVs(SummaryToJSON(g_txindex->GetSummary(), index_name)); |
| 824 | } |
| 825 | |
| 826 | if (g_coin_stats_index) { |
| 827 | result.pushKVs(SummaryToJSON(g_coin_stats_index->GetSummary(), index_name)); |
| 828 | } |
| 829 | |
| 830 | ForEachBlockFilterIndex([&result, &index_name](const BlockFilterIndex& index) { |
| 831 | result.pushKVs(SummaryToJSON(index.GetSummary(), index_name)); |
| 832 | }); |
| 833 | |
| 834 | return result; |
| 835 | }, |
| 836 | }; |
| 837 | } |
| 838 | |
| 839 | // |
| 840 | // ELEMENTS CALLS |
nothing calls this directly
no test coverage detected