From f81ef4303e057e85aa24772c865287c17ffa4350 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Barbosa?= Date: Wed, 14 Apr 2021 15:01:00 +0100 Subject: rpc: Keep default argument value in correct type --- src/rpc/util.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/rpc/util.cpp') diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp index ba3105ca01..71c6160322 100644 --- a/src/rpc/util.cpp +++ b/src/rpc/util.cpp @@ -646,7 +646,7 @@ std::string RPCArg::GetName() const bool RPCArg::IsOptional() const { - if (m_fallback.index() == 1) { + if (m_fallback.index() != 0) { return true; } else { return RPCArg::Optional::NO != std::get(m_fallback); @@ -694,7 +694,9 @@ std::string RPCArg::ToDescriptionString() const } // no default case, so the compiler can warn about missing cases } if (m_fallback.index() == 1) { - ret += ", optional, default=" + std::get(m_fallback); + ret += ", optional, default=" + std::get(m_fallback); + } else if (m_fallback.index() == 2) { + ret += ", optional, default=" + std::get(m_fallback).write(); } else { switch (std::get(m_fallback)) { case RPCArg::Optional::OMITTED: { -- cgit v1.2.3