| 1018 | } |
| 1019 | |
| 1020 | static RPCMethod gettxoutsetinfo() |
| 1021 | { |
| 1022 | return RPCMethod{ |
| 1023 | "gettxoutsetinfo", |
| 1024 | "Returns statistics about the unspent transaction output set.\n" |
| 1025 | "Note this call may take some time if you are not using coinstatsindex.\n", |
| 1026 | { |
| 1027 | {"hash_type", RPCArg::Type::STR, RPCArg::Default{"hash_serialized_3"}, "Which UTXO set hash should be calculated. Options: 'hash_serialized_3' (the legacy algorithm), 'muhash', 'none'."}, |
| 1028 | {"hash_or_height", RPCArg::Type::NUM, RPCArg::DefaultHint{"the current best block"}, "The block hash or height of the target height (only available with coinstatsindex).", |
| 1029 | RPCArgOptions{ |
| 1030 | .skip_type_check = true, |
| 1031 | .type_str = {"", "string or numeric"}, |
| 1032 | }}, |
| 1033 | {"use_index", RPCArg::Type::BOOL, RPCArg::Default{true}, "Use coinstatsindex, if available."}, |
| 1034 | }, |
| 1035 | RPCResult{ |
| 1036 | RPCResult::Type::OBJ, "", "", |
| 1037 | { |
| 1038 | {RPCResult::Type::NUM, "height", "The block height (index) of the returned statistics"}, |
| 1039 | {RPCResult::Type::STR_HEX, "bestblock", "The hash of the block at which these statistics are calculated"}, |
| 1040 | {RPCResult::Type::NUM, "txouts", "The number of unspent transaction outputs"}, |
| 1041 | {RPCResult::Type::NUM, "bogosize", "Database-independent, meaningless metric indicating the UTXO set size"}, |
| 1042 | {RPCResult::Type::STR_HEX, "hash_serialized_3", /*optional=*/true, "The serialized hash (only present if 'hash_serialized_3' hash_type is chosen)"}, |
| 1043 | {RPCResult::Type::STR_HEX, "muhash", /*optional=*/true, "The serialized hash (only present if 'muhash' hash_type is chosen)"}, |
| 1044 | {RPCResult::Type::NUM, "transactions", /*optional=*/true, "The number of transactions with unspent outputs (not available when coinstatsindex is used)"}, |
| 1045 | {RPCResult::Type::NUM, "disk_size", /*optional=*/true, "The estimated size of the chainstate on disk (not available when coinstatsindex is used)"}, |
| 1046 | {RPCResult::Type::STR_AMOUNT, "total_amount", "The total amount of coins in the UTXO set"}, |
| 1047 | {RPCResult::Type::STR_AMOUNT, "total_unspendable_amount", /*optional=*/true, "The total amount of coins permanently excluded from the UTXO set (only available if coinstatsindex is used)"}, |
| 1048 | {RPCResult::Type::OBJ, "block_info", /*optional=*/true, "Info on amounts in the block at this block height (only available if coinstatsindex is used)", |
| 1049 | { |
| 1050 | {RPCResult::Type::STR_AMOUNT, "prevout_spent", "Total amount of all prevouts spent in this block"}, |
| 1051 | {RPCResult::Type::STR_AMOUNT, "coinbase", "Coinbase subsidy amount of this block"}, |
| 1052 | {RPCResult::Type::STR_AMOUNT, "new_outputs_ex_coinbase", "Total amount of new outputs created by this block"}, |
| 1053 | {RPCResult::Type::STR_AMOUNT, "unspendable", "Total amount of unspendable outputs created in this block"}, |
| 1054 | {RPCResult::Type::OBJ, "unspendables", "Detailed view of the unspendable categories", |
| 1055 | { |
| 1056 | {RPCResult::Type::STR_AMOUNT, "genesis_block", "The unspendable amount of the Genesis block subsidy"}, |
| 1057 | {RPCResult::Type::STR_AMOUNT, "bip30", "Transactions overridden by duplicates (no longer possible with BIP30)"}, |
| 1058 | {RPCResult::Type::STR_AMOUNT, "scripts", "Amounts sent to scripts that are unspendable (for example OP_RETURN outputs)"}, |
| 1059 | {RPCResult::Type::STR_AMOUNT, "unclaimed_rewards", "Fee rewards that miners did not claim in their coinbase transaction"}, |
| 1060 | }} |
| 1061 | }}, |
| 1062 | }}, |
| 1063 | RPCExamples{ |
| 1064 | HelpExampleCli("gettxoutsetinfo", "") + |
| 1065 | HelpExampleCli("gettxoutsetinfo", R"("none")") + |
| 1066 | HelpExampleCli("gettxoutsetinfo", R"("none" 1000)") + |
| 1067 | HelpExampleCli("gettxoutsetinfo", R"("none" '"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09"')") + |
| 1068 | HelpExampleCli("-named gettxoutsetinfo", R"(hash_type='muhash' use_index='false')") + |
| 1069 | HelpExampleRpc("gettxoutsetinfo", "") + |
| 1070 | HelpExampleRpc("gettxoutsetinfo", R"("none")") + |
| 1071 | HelpExampleRpc("gettxoutsetinfo", R"("none", 1000)") + |
| 1072 | HelpExampleRpc("gettxoutsetinfo", R"("none", "00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09")") |
| 1073 | }, |
| 1074 | [](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue |
| 1075 | { |
| 1076 | UniValue ret(UniValue::VOBJ); |
| 1077 |
nothing calls this directly
no test coverage detected