refactor: move verbosity parsing to rpc/util

Provides a common way for rpcs to obtain
verbosity from an rpc parameter
This commit is contained in:
tdb3
2024-09-18 12:28:43 -04:00
parent 532491faf1
commit f511ff3654
4 changed files with 23 additions and 17 deletions

View File

@@ -766,14 +766,7 @@ static RPCHelpMan getblock()
{
uint256 hash(ParseHashV(request.params[0], "blockhash"));
int verbosity = 1;
if (!request.params[1].isNull()) {
if (request.params[1].isBool()) {
verbosity = request.params[1].get_bool() ? 1 : 0;
} else {
verbosity = request.params[1].getInt<int>();
}
}
int verbosity{ParseVerbosity(request.params[1], /*default_verbosity=*/1)};
const CBlockIndex* pblockindex;
const CBlockIndex* tip;