mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 23:29:12 +01:00
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:
@@ -81,6 +81,18 @@ void RPCTypeCheckObj(const UniValue& o,
|
||||
}
|
||||
}
|
||||
|
||||
int ParseVerbosity(const UniValue& arg, int default_verbosity)
|
||||
{
|
||||
if (!arg.isNull()) {
|
||||
if (arg.isBool()) {
|
||||
return arg.get_bool(); // true = 1
|
||||
} else {
|
||||
return arg.getInt<int>();
|
||||
}
|
||||
}
|
||||
return default_verbosity;
|
||||
}
|
||||
|
||||
CAmount AmountFromValue(const UniValue& value, int decimals)
|
||||
{
|
||||
if (!value.isNum() && !value.isStr())
|
||||
|
||||
Reference in New Issue
Block a user