Skip to content

Commit 0031ef5

Browse files
Code simplification around constants used
Co-authored-by: pablomartin4btc <[email protected]>
1 parent 454fc48 commit 0031ef5

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/qt/rpcconsole.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -419,10 +419,9 @@ void RPCExecutor::request(const QString &command, const WalletModel* wallet_mode
419419
std::regex invalidRegex("generate[\\s\\(]+.*");
420420
std::smatch match;
421421
if (std::regex_match(executableCommand, match, validRegex)) {
422-
std::string nblocks=match[1];
423-
std::string maxtries=match[2];
424-
if (nblocks=="") nblocks = "1";
425-
if (maxtries=="") maxtries = "1000000";
422+
const std::string nblocks{match.str(1) == "" ? "1" : match.str(1)};
423+
const std::string maxtries{match.str(2) == "" ? "1000000" : match.str(2)};
424+
426425
if (!RPCConsole::RPCExecuteCommandLine(m_node, result, "getnewaddress\n", nullptr, wallet_model)) {
427426
Q_EMIT reply(RPCConsole::CMD_ERROR, QString("Parse error: unbalanced ' or \""));
428427
}

0 commit comments

Comments
 (0)