Skip to content

Commit

Permalink
Code simplification around constants used
Browse files Browse the repository at this point in the history
Co-authored-by: pablomartin4btc <[email protected]>
  • Loading branch information
hernanmarino and pablomartin4btc authored Dec 29, 2022
1 parent 454fc48 commit 0031ef5
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/qt/rpcconsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 \""));
}
Expand Down

0 comments on commit 0031ef5

Please sign in to comment.