Skip to content

Commit fa0ff66

Browse files
author
MarcoFalke
committed
rpc: Implement RPCHelpMan::ArgValue<> for UniValue
1 parent baed5ed commit fa0ff66

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/rpc/util.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,11 +678,13 @@ static void CheckRequiredOrDefault(const RPCArg& param)
678678
void force_semicolon(ret_type)
679679

680680
// Optional arg (without default). Can also be called on required args, if needed.
681+
TMPL_INST(nullptr, const UniValue*, maybe_arg;);
681682
TMPL_INST(nullptr, std::optional<double>, maybe_arg ? std::optional{maybe_arg->get_real()} : std::nullopt;);
682683
TMPL_INST(nullptr, std::optional<bool>, maybe_arg ? std::optional{maybe_arg->get_bool()} : std::nullopt;);
683684
TMPL_INST(nullptr, const std::string*, maybe_arg ? &maybe_arg->get_str() : nullptr;);
684685

685686
// Required arg or optional arg with default value.
687+
TMPL_INST(CheckRequiredOrDefault, const UniValue&, *CHECK_NONFATAL(maybe_arg););
686688
TMPL_INST(CheckRequiredOrDefault, bool, CHECK_NONFATAL(maybe_arg)->get_bool(););
687689
TMPL_INST(CheckRequiredOrDefault, int, CHECK_NONFATAL(maybe_arg)->getInt<int>(););
688690
TMPL_INST(CheckRequiredOrDefault, uint64_t, CHECK_NONFATAL(maybe_arg)->getInt<uint64_t>(););

0 commit comments

Comments
 (0)