mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-16 13:01:19 +02: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:
parent
532491faf1
commit
f511ff3654
4 changed files with 23 additions and 17 deletions
|
|
@ -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())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue