@@ -63,6 +63,14 @@ const struct {
63
63
{NULL , NULL }
64
64
};
65
65
66
+ // don't add private key handling cmd's to the history
67
+ const QStringList RPCConsole::historyFilter = QStringList()
68
+ << " importprivkey"
69
+ << " signrawtransaction"
70
+ << " walletpassphrase"
71
+ << " walletpassphrasechange"
72
+ << " encryptwallet" ;
73
+
66
74
/* Object for executing console RPC commands in a separate thread.
67
75
*/
68
76
class RPCExecutor : public QObject
@@ -755,15 +763,26 @@ void RPCConsole::on_lineEdit_returnPressed()
755
763
756
764
message (CMD_REQUEST, cmd);
757
765
Q_EMIT cmdRequest (cmd);
758
- // Remove command, if already in history
759
- history.removeOne (cmd);
760
- // Append command to history
761
- history.append (cmd);
762
- // Enforce maximum history size
763
- while (history.size () > CONSOLE_HISTORY)
764
- history.removeFirst ();
765
- // Set pointer to end of history
766
- historyPtr = history.size ();
766
+
767
+ bool storeHistory = true ;
768
+ Q_FOREACH (QString unallowedCmd, historyFilter)
769
+ {
770
+ if (cmd.trimmed ().startsWith (unallowedCmd))
771
+ storeHistory = false ; break ;
772
+ }
773
+
774
+ if (storeHistory)
775
+ {
776
+ // Remove command, if already in history
777
+ history.removeOne (cmd);
778
+ // Append command to history
779
+ history.append (cmd);
780
+ // Enforce maximum history size
781
+ while (history.size () > CONSOLE_HISTORY)
782
+ history.removeFirst ();
783
+ // Set pointer to end of history
784
+ historyPtr = history.size ();
785
+ }
767
786
// Scroll console view to end
768
787
scrollToEnd ();
769
788
}
0 commit comments