@@ -96,6 +96,7 @@ public Q_SLOTS:
9696
9797Q_SIGNALS:
9898 void reply (int category, const QString &command);
99+ void noop ();
99100
100101private:
101102 interfaces::Node& m_node;
@@ -361,6 +362,8 @@ bool RPCConsole::RPCParseCommandLine(interfaces::Node* node, std::string &strRes
361362 for (auto i = filter_ranges.rbegin (); i != filter_ranges.rend (); ++i) {
362363 pstrFilteredOut->replace (i->first , i->second - i->first , " (…)" );
363364 }
365+ // Prefix "#" to comment out sensitive commands when recalled from history, preventing re-execution
366+ if (filter_ranges.size () > 0 && !pstrFilteredOut->starts_with (" #" )) pstrFilteredOut->insert (0 , " #" );
364367 }
365368 switch (state) // final state
366369 {
@@ -405,9 +408,16 @@ void RPCExecutor::request(const QString &command, const QString& wallet_name)
405408 " example: getblock(getblockhash(0) 1)[tx]\n\n "
406409
407410 " Results without keys can be queried with an integer in brackets using the parenthesized syntax.\n "
408- " example: getblock(getblockhash(0),1)[tx][0]\n\n " )));
411+ " example: getblock(getblockhash(0),1)[tx][0]\n\n "
412+
413+ " Lines starting with '#' are treated as comments and are not executed.\n "
414+ " example: # Hello world\n\n " )));
415+ return ;
416+ } else if (executableCommand.starts_with (" #" )) {
417+ Q_EMIT noop ();
409418 return ;
410419 }
420+
411421 if (!RPCConsole::RPCExecuteCommandLine (m_node, result, executableCommand, nullptr , wallet_name)) {
412422 Q_EMIT reply (RPCConsole::CMD_ERROR, QString (" Parse error: unbalanced ' or \" " ));
413423 return ;
@@ -1094,6 +1104,12 @@ void RPCConsole::startExecutor()
10941104 m_is_executing = false ;
10951105 });
10961106
1107+ connect (m_executor, &RPCExecutor::noop, this , [this ]() {
1108+ ui->messagesWidget ->undo ();
1109+ scrollToEnd ();
1110+ m_is_executing = false ;
1111+ });
1112+
10971113 // Make sure executor object is deleted in its own thread
10981114 connect (&thread, &QThread::finished, m_executor, &RPCExecutor::deleteLater);
10991115
0 commit comments