refactor: Use self.Arg<bool> in getopenrpcinfo

This is clearer, because it does not encode the default value in the
source code syntax. Also, using named args is clearer than positional
args.

Also, run clang-format on the new code.
This commit is contained in:
MarcoFalke
2026-07-29 16:49:57 +02:00
parent fa1871a528
commit fa3aadbc32

View File

@@ -570,10 +570,10 @@ static RPCMethod getopenrpcinfo()
+ HelpExampleRpc("getopenrpcinfo", "")
},
[](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue
{
const bool include_hidden{!request.params[0].isNull() && request.params[0].get_bool()};
return tableRPC.buildOpenRPCDoc(include_hidden);
},
{
const bool include_hidden{self.Arg<bool>("show_hidden")};
return tableRPC.buildOpenRPCDoc(include_hidden);
},
};
}
@@ -589,9 +589,9 @@ static RPCMethod rpc_discover()
+ HelpExampleRpc("rpc.discover", "")
},
[](const RPCMethod&, const JSONRPCRequest&) -> UniValue
{
return tableRPC.buildOpenRPCDoc(/*include_hidden=*/false);
},
{
return tableRPC.buildOpenRPCDoc(/*include_hidden=*/false);
},
};
}