From 0031ef549fbaa7bc4c3c67012a65e97cd70034ff Mon Sep 17 00:00:00 2001 From: hernanmarino <87907936+hernanmarino@users.noreply.github.com> Date: Thu, 29 Dec 2022 12:19:32 -0300 Subject: [PATCH] Code simplification around constants used Co-authored-by: pablomartin4btc <110166421+pablomartin4btc@users.noreply.github.com> --- src/qt/rpcconsole.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 8e73cab019b..e1e8f737037 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -419,10 +419,9 @@ void RPCExecutor::request(const QString &command, const WalletModel* wallet_mode std::regex invalidRegex("generate[\\s\\(]+.*"); std::smatch match; if (std::regex_match(executableCommand, match, validRegex)) { - std::string nblocks=match[1]; - std::string maxtries=match[2]; - if (nblocks=="") nblocks = "1"; - if (maxtries=="") maxtries = "1000000"; + const std::string nblocks{match.str(1) == "" ? "1" : match.str(1)}; + const std::string maxtries{match.str(2) == "" ? "1000000" : match.str(2)}; + if (!RPCConsole::RPCExecuteCommandLine(m_node, result, "getnewaddress\n", nullptr, wallet_model)) { Q_EMIT reply(RPCConsole::CMD_ERROR, QString("Parse error: unbalanced ' or \"")); }