rpc: use enum instead of string for filter type

This commit is contained in:
w0xlt 2022-06-27 14:33:10 -03:00
parent 0dd3477333
commit baf4efe02f

View File

@ -2177,7 +2177,7 @@ static RPCHelpMan getblockfilter()
"\nRetrieve a BIP 157 content filter for a particular block.\n", "\nRetrieve a BIP 157 content filter for a particular block.\n",
{ {
{"blockhash", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The hash of the block"}, {"blockhash", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "The hash of the block"},
{"filtertype", RPCArg::Type::STR, RPCArg::Default{"basic"}, "The type name of the filter"}, {"filtertype", RPCArg::Type::STR, RPCArg::Default{BlockFilterTypeName(BlockFilterType::BASIC)}, "The type name of the filter"},
}, },
RPCResult{ RPCResult{
RPCResult::Type::OBJ, "", "", RPCResult::Type::OBJ, "", "",
@ -2192,7 +2192,7 @@ static RPCHelpMan getblockfilter()
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
{ {
uint256 block_hash = ParseHashV(request.params[0], "blockhash"); uint256 block_hash = ParseHashV(request.params[0], "blockhash");
std::string filtertype_name = "basic"; std::string filtertype_name = BlockFilterTypeName(BlockFilterType::BASIC);
if (!request.params[1].isNull()) { if (!request.params[1].isNull()) {
filtertype_name = request.params[1].get_str(); filtertype_name = request.params[1].get_str();
} }