| 940 | } |
| 941 | |
| 942 | static RPCHelpMan calcfastmerkleroot() |
| 943 | { |
| 944 | return RPCHelpMan{"calcfastmerkleroot", |
| 945 | "\nhidden utility RPC for computing sha2 midstates\n", |
| 946 | { |
| 947 | {"leaves", RPCArg::Type::ARR, RPCArg::Optional::NO, "array of data to compute the fast merkle root of.", |
| 948 | { |
| 949 | {"data", RPCArg::Type::STR_HEX, RPCArg::Optional::OMITTED, "hex-encoded data"}, |
| 950 | }}, |
| 951 | }, |
| 952 | RPCResult{ |
| 953 | RPCResult::Type::STR_HEX, "", "merkle root of provided data" |
| 954 | }, |
| 955 | RPCExamples{ |
| 956 | HelpExampleCli("calcfastmerkleroot", "[\"a\", \"b\", \"c\"]") |
| 957 | }, |
| 958 | [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue |
| 959 | { |
| 960 | std::vector<uint256> leaves; |
| 961 | for (const UniValue& leaf : request.params[0].get_array().getValues()) { |
| 962 | uint256 l; |
| 963 | l.SetHex(leaf.get_str()); |
| 964 | leaves.push_back(l); |
| 965 | } |
| 966 | |
| 967 | uint256 root = ComputeFastMerkleRoot(leaves); |
| 968 | |
| 969 | UniValue ret(UniValue::VOBJ); |
| 970 | ret.setStr(root.GetHex()); |
| 971 | return ret; |
| 972 | }, |
| 973 | }; |
| 974 | } |
| 975 | |
| 976 | static RPCHelpMan dumpassetlabels() |
| 977 | { |
nothing calls this directly
no test coverage detected