5 #if defined(HAVE_CONFIG_H)
10 #include <qt/forms/ui_debugwindow.h>
35 #include <QMessageBox>
40 #include <QStringList>
54 {
"cmd-request",
":/icons/tx_input"},
55 {
"cmd-reply",
":/icons/tx_output"},
56 {
"cmd-error",
":/icons/tx_output"},
57 {
"misc",
":/icons/tx_inout"},
64 const QStringList historyFilter = QStringList()
68 <<
"signmessagewithprivkey"
69 <<
"signrawtransactionwithkey"
71 <<
"walletpassphrasechange"
88 void reply(
int category,
const QString &command);
104 timer.setSingleShot(
true);
105 connect(&
timer, &QTimer::timeout, [
this]{
func(); });
118 const char *
Name()
override {
return "Qt"; }
126 #include <qt/rpcconsole.moc>
150 std::vector< std::vector<std::string> > stack;
151 stack.push_back(std::vector<std::string>());
156 STATE_EATING_SPACES_IN_ARG,
157 STATE_EATING_SPACES_IN_BRACKETS,
162 STATE_ESCAPE_DOUBLEQUOTED,
163 STATE_COMMAND_EXECUTED,
164 STATE_COMMAND_EXECUTED_INNER
165 } state = STATE_EATING_SPACES;
168 unsigned nDepthInsideSensitive = 0;
169 size_t filter_begin_pos = 0, chpos;
170 std::vector<std::pair<size_t, size_t>> filter_ranges;
172 auto add_to_current_stack = [&](
const std::string& strArg) {
173 if (stack.back().empty() && (!nDepthInsideSensitive) && historyFilter.contains(QString::fromStdString(strArg), Qt::CaseInsensitive)) {
174 nDepthInsideSensitive = 1;
175 filter_begin_pos = chpos;
179 stack.
push_back(std::vector<std::string>());
181 stack.back().push_back(strArg);
184 auto close_out_params = [&]() {
185 if (nDepthInsideSensitive) {
186 if (!--nDepthInsideSensitive) {
187 assert(filter_begin_pos);
188 filter_ranges.push_back(std::make_pair(filter_begin_pos, chpos));
189 filter_begin_pos = 0;
195 std::string strCommandTerminated = strCommand;
196 if (strCommandTerminated.back() !=
'\n')
197 strCommandTerminated +=
"\n";
198 for (chpos = 0; chpos < strCommandTerminated.size(); ++chpos)
200 char ch = strCommandTerminated[chpos];
203 case STATE_COMMAND_EXECUTED_INNER:
204 case STATE_COMMAND_EXECUTED:
206 bool breakParsing =
true;
209 case '[': curarg.clear(); state = STATE_COMMAND_EXECUTED_INNER;
break;
211 if (state == STATE_COMMAND_EXECUTED_INNER)
219 if (curarg.size() && fExecute)
225 for(
char argch: curarg)
227 throw std::runtime_error(
"Invalid result query");
228 subelement = lastResult[
atoi(curarg.c_str())];
233 throw std::runtime_error(
"Invalid result query");
234 lastResult = subelement;
237 state = STATE_COMMAND_EXECUTED;
241 breakParsing =
false;
247 if (lastResult.
isStr())
250 curarg = lastResult.
write(2);
256 add_to_current_stack(curarg);
262 state = STATE_EATING_SPACES;
268 case STATE_EATING_SPACES_IN_ARG:
269 case STATE_EATING_SPACES_IN_BRACKETS:
270 case STATE_EATING_SPACES:
273 case '"': state = STATE_DOUBLEQUOTED;
break;
274 case '\'': state = STATE_SINGLEQUOTED;
break;
275 case '\\': state = STATE_ESCAPE_OUTER;
break;
276 case '(':
case ')':
case '\n':
277 if (state == STATE_EATING_SPACES_IN_ARG)
278 throw std::runtime_error(
"Invalid Syntax");
279 if (state == STATE_ARGUMENT)
281 if (ch ==
'(' && stack.size() && stack.back().size() > 0)
283 if (nDepthInsideSensitive) {
284 ++nDepthInsideSensitive;
286 stack.push_back(std::vector<std::string>());
291 throw std::runtime_error(
"Invalid Syntax");
293 add_to_current_stack(curarg);
295 state = STATE_EATING_SPACES_IN_BRACKETS;
297 if ((ch ==
')' || ch ==
'\n') && stack.size() > 0)
302 UniValue params =
RPCConvertValues(stack.back()[0], std::vector<std::string>(stack.back().begin() + 1, stack.back().end()));
303 std::string method = stack.back()[0];
307 QByteArray encodedName = QUrl::toPercentEncoding(wallet_model->
getWalletName());
308 uri =
"/wallet/"+std::string(encodedName.constData(), encodedName.length());
312 lastResult = node->
executeRpc(method, params, uri);
315 state = STATE_COMMAND_EXECUTED;
319 case ' ':
case ',':
case '\t':
320 if(state == STATE_EATING_SPACES_IN_ARG && curarg.empty() && ch ==
',')
321 throw std::runtime_error(
"Invalid Syntax");
323 else if(state == STATE_ARGUMENT)
325 add_to_current_stack(curarg);
328 if ((state == STATE_EATING_SPACES_IN_BRACKETS || state == STATE_ARGUMENT) && ch ==
',')
330 state = STATE_EATING_SPACES_IN_ARG;
333 state = STATE_EATING_SPACES;
335 default: curarg += ch; state = STATE_ARGUMENT;
338 case STATE_SINGLEQUOTED:
341 case '\'': state = STATE_ARGUMENT;
break;
342 default: curarg += ch;
345 case STATE_DOUBLEQUOTED:
348 case '"': state = STATE_ARGUMENT;
break;
349 case '\\': state = STATE_ESCAPE_DOUBLEQUOTED;
break;
350 default: curarg += ch;
353 case STATE_ESCAPE_OUTER:
354 curarg += ch; state = STATE_ARGUMENT;
356 case STATE_ESCAPE_DOUBLEQUOTED:
357 if(ch !=
'"' && ch !=
'\\') curarg +=
'\\';
358 curarg += ch; state = STATE_DOUBLEQUOTED;
362 if (pstrFilteredOut) {
363 if (STATE_COMMAND_EXECUTED == state) {
364 assert(!stack.empty());
367 *pstrFilteredOut = strCommand;
368 for (
auto i = filter_ranges.rbegin(); i != filter_ranges.rend(); ++i) {
369 pstrFilteredOut->replace(i->first, i->second - i->first,
"(…)");
374 case STATE_COMMAND_EXECUTED:
375 if (lastResult.
isStr())
376 strResult = lastResult.
get_str();
378 strResult = lastResult.
write(2);
380 case STATE_EATING_SPACES:
392 std::string executableCommand = command.toStdString() +
"\n";
395 if(executableCommand ==
"help-console\n") {
397 "This console accepts RPC commands using the standard syntax.\n"
398 " example: getblockhash 0\n\n"
400 "This console can also accept RPC commands using the parenthesized syntax.\n"
401 " example: getblockhash(0)\n\n"
403 "Commands may be nested when specified with the parenthesized syntax.\n"
404 " example: getblock(getblockhash(0) 1)\n\n"
406 "A space or a comma can be used to delimit arguments for either syntax.\n"
407 " example: getblockhash 0\n"
408 " getblockhash,0\n\n"
410 "Named results can be queried with a non-quoted key string in brackets using the parenthesized syntax.\n"
411 " example: getblock(getblockhash(0) 1)[tx]\n\n"
413 "Results without keys can be queried with an integer in brackets using the parenthesized syntax.\n"
414 " example: getblock(getblockhash(0),1)[tx][0]\n\n")));
432 catch (
const std::runtime_error&)
437 catch (
const std::exception& e)
447 platformStyle(_platformStyle)
451 if (!restoreGeometry(settings.value(
"RPCConsoleWindowGeometry").toByteArray())) {
453 move(QGuiApplication::primaryScreen()->availableGeometry().center() - frameGeometry().center());
456 QChar nonbreaking_hyphen(8209);
457 ui->dataDir->setToolTip(
ui->dataDir->toolTip().arg(QString(nonbreaking_hyphen) +
"datadir"));
458 ui->blocksDir->setToolTip(
ui->blocksDir->toolTip().arg(QString(nonbreaking_hyphen) +
"blocksdir"));
459 ui->openDebugLogfileButton->setToolTip(
ui->openDebugLogfileButton->toolTip().arg(
PACKAGE_NAME));
469 ui->lineEdit->installEventFilter(
this);
470 ui->lineEdit->setMaxLength(16 * 1024 * 1024);
471 ui->messagesWidget->installEventFilter(
this);
479 ui->WalletSelector->setVisible(
false);
480 ui->WalletSelectorLabel->setVisible(
false);
486 ui->label_berkeleyDBVersion->hide();
487 ui->berkeleyDBVersion->hide();
497 ui->detailWidget->hide();
498 ui->peerHeading->setText(tr(
"Select a peer to view detailed information."));
509 settings.setValue(
"RPCConsoleWindowGeometry", saveGeometry());
517 if(event->type() == QEvent::KeyPress)
519 QKeyEvent *keyevt =
static_cast<QKeyEvent*
>(event);
520 int key = keyevt->key();
521 Qt::KeyboardModifiers mod = keyevt->modifiers();
524 case Qt::Key_Up:
if(obj ==
ui->lineEdit) {
browseHistory(-1);
return true; }
break;
525 case Qt::Key_Down:
if(obj ==
ui->lineEdit) {
browseHistory(1);
return true; }
break;
527 case Qt::Key_PageDown:
528 if(obj ==
ui->lineEdit)
530 QApplication::postEvent(
ui->messagesWidget,
new QKeyEvent(*keyevt));
538 QApplication::postEvent(
ui->lineEdit,
new QKeyEvent(*keyevt));
546 if(obj ==
ui->messagesWidget && (
547 (!mod && !keyevt->text().isEmpty() && key != Qt::Key_Tab) ||
548 ((mod & Qt::ControlModifier) && key == Qt::Key_V) ||
549 ((mod & Qt::ShiftModifier) && key == Qt::Key_Insert)))
551 ui->lineEdit->setFocus();
552 QApplication::postEvent(
ui->lineEdit,
new QKeyEvent(*keyevt));
557 return QWidget::eventFilter(obj, event);
564 bool wallet_enabled{
false};
567 #endif // ENABLE_WALLET
568 if (model && !wallet_enabled) {
574 ui->trafficGraph->setClientModel(model);
580 setNumBlocks(bestblock_height, QDateTime::fromTime_t(bestblock_date), verification_progress,
false);
594 ui->peerWidget->verticalHeader()->hide();
595 ui->peerWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
596 ui->peerWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
597 ui->peerWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
598 ui->peerWidget->setContextMenuPolicy(Qt::CustomContextMenu);
602 ui->peerWidget->horizontalHeader()->setStretchLastSection(
true);
605 QAction* disconnectAction =
new QAction(tr(
"&Disconnect"),
this);
606 QAction* banAction1h =
new QAction(tr(
"Ban for") +
" " + tr(
"1 &hour"),
this);
607 QAction* banAction24h =
new QAction(tr(
"Ban for") +
" " + tr(
"1 &day"),
this);
608 QAction* banAction7d =
new QAction(tr(
"Ban for") +
" " + tr(
"1 &week"),
this);
609 QAction* banAction365d =
new QAction(tr(
"Ban for") +
" " + tr(
"1 &year"),
this);
619 connect(banAction1h, &QAction::triggered, [
this] {
banSelectedNode(60 * 60); });
620 connect(banAction24h, &QAction::triggered, [
this] {
banSelectedNode(60 * 60 * 24); });
621 connect(banAction7d, &QAction::triggered, [
this] {
banSelectedNode(60 * 60 * 24 * 7); });
622 connect(banAction365d, &QAction::triggered, [
this] {
banSelectedNode(60 * 60 * 24 * 365); });
637 ui->banlistWidget->verticalHeader()->hide();
638 ui->banlistWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
639 ui->banlistWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
640 ui->banlistWidget->setSelectionMode(QAbstractItemView::SingleSelection);
641 ui->banlistWidget->setContextMenuPolicy(Qt::CustomContextMenu);
644 ui->banlistWidget->horizontalHeader()->setStretchLastSection(
true);
647 QAction* unbanAction =
new QAction(tr(
"&Unban"),
this);
669 ui->networkName->setText(QString::fromStdString(
Params().NetworkIDString()));
672 QStringList wordList;
674 for (
size_t i = 0; i < commandList.size(); ++i)
676 wordList << commandList[i].c_str();
677 wordList << (
"help " + commandList[i]).c_str();
680 wordList <<
"help-console";
683 autoCompleter->setModelSorting(QCompleter::CaseSensitivelySortedModel);
686 ui->lineEdit->setEnabled(
true);
703 ui->WalletSelector->addItem(walletModel->
getDisplayName(), QVariant::fromValue(walletModel));
704 if (
ui->WalletSelector->count() == 2 && !isVisible()) {
706 ui->WalletSelector->setCurrentIndex(1);
708 if (
ui->WalletSelector->count() > 2) {
709 ui->WalletSelector->setVisible(
true);
710 ui->WalletSelectorLabel->setVisible(
true);
716 ui->WalletSelector->removeItem(
ui->WalletSelector->findData(QVariant::fromValue(walletModel)));
717 if (
ui->WalletSelector->count() == 2) {
718 ui->WalletSelector->setVisible(
false);
719 ui->WalletSelectorLabel->setVisible(
false);
731 default:
return "misc";
754 QString str =
ui->messagesWidget->toHtml();
757 str.replace(QString(
"font-size:%1pt").arg(
consoleFontSize), QString(
"font-size:%1pt").arg(newSize));
764 float oldPosFactor = 1.0 /
ui->messagesWidget->verticalScrollBar()->maximum() *
ui->messagesWidget->verticalScrollBar()->value();
766 ui->messagesWidget->setHtml(str);
767 ui->messagesWidget->verticalScrollBar()->setValue(oldPosFactor *
ui->messagesWidget->verticalScrollBar()->maximum());
772 ui->messagesWidget->clear();
778 ui->lineEdit->clear();
779 ui->lineEdit->setFocus();
785 ui->messagesWidget->document()->addResource(
786 QTextDocument::ImageResource,
793 ui->messagesWidget->document()->setDefaultStyleSheet(
796 "td.time { color: #808080; font-size: %2; padding-top: 3px; } "
797 "td.message { font-family: %1; font-size: %2; white-space:pre-wrap; } "
798 "td.cmd-request { color: #006060; } "
799 "td.cmd-error { color: red; } "
800 ".secwarning { color: red; }"
801 "b { color: #006060; } "
806 QString clsKey =
"(⌘)-L";
808 QString clsKey =
"Ctrl-L";
812 tr(
"Use up and down arrows to navigate history, and %1 to clear screen.").arg(
"<b>"+clsKey+
"</b>") +
"<br>" +
813 tr(
"Type %1 for an overview of available commands.").arg(
"<b>help</b>") +
"<br>" +
814 tr(
"For more information on using this console type %1.").arg(
"<b>help-console</b>") +
815 "<br><span class=\"secwarning\"><br>" +
816 tr(
"WARNING: Scammers have been active, telling users to type commands here, stealing their wallet contents. Do not use this console without fully understanding the ramifications of a command.") +
823 if(windowType() != Qt::Widget && event->key() == Qt::Key_Escape)
831 QTime time = QTime::currentTime();
832 QString timeString = time.toString();
834 out +=
"<table><tr><td class=\"time\" width=\"65\">" + timeString +
"</td>";
835 out +=
"<td class=\"icon\" width=\"32\"><img src=\"" +
categoryClass(category) +
"\"></td>";
836 out +=
"<td class=\"message " +
categoryClass(category) +
"\" valign=\"middle\">";
841 out +=
"</td></tr></table>";
842 ui->messagesWidget->append(out);
852 connections +=
" (" + tr(
"Network activity disabled") +
")";
855 ui->numberOfConnections->setText(connections);
874 ui->numberOfBlocks->setText(QString::number(count));
875 ui->lastBlockTime->setText(blockDate.toString());
881 ui->mempoolNumberTxs->setText(QString::number(numberOfTxs));
883 if (dynUsage < 1000000)
884 ui->mempoolSize->setText(QString::number(dynUsage/1000.0,
'f', 2) +
" KB");
886 ui->mempoolSize->setText(QString::number(dynUsage/1000000.0,
'f', 2) +
" MB");
891 QString cmd =
ui->lineEdit->text();
895 std::string strFilteredCmd;
900 throw std::runtime_error(
"Invalid command line");
902 }
catch (
const std::exception& e) {
903 QMessageBox::critical(
this,
"Error", QString(
"Error: ") + QString::fromStdString(e.what()));
907 ui->lineEdit->clear();
927 cmd = QString::fromStdString(strFilteredCmd);
962 ui->lineEdit->setText(cmd);
968 executor->moveToThread(&
thread);
977 connect(&
thread, &QThread::finished, executor, &RPCExecutor::deleteLater);
982 QTimer::singleShot(0, executor, []() {
989 if (
ui->tabWidget->widget(index) ==
ui->tab_console) {
990 ui->lineEdit->setFocus();
1001 QScrollBar *scrollbar =
ui->messagesWidget->verticalScrollBar();
1002 scrollbar->setValue(scrollbar->maximum());
1007 const int multiplier = 5;
1008 int mins = value * multiplier;
1014 ui->trafficGraph->setGraphRangeMins(mins);
1026 Q_UNUSED(deselected);
1038 QModelIndexList selected =
ui->peerWidget->selectionModel()->selectedIndexes();
1040 for(
int i = 0; i < selected.size(); i++)
1053 bool fUnselect =
false;
1054 bool fReselect =
false;
1060 int selectedRow = -1;
1061 QModelIndexList selectedModelIndex =
ui->peerWidget->selectionModel()->selectedIndexes();
1062 if (!selectedModelIndex.isEmpty()) {
1063 selectedRow = selectedModelIndex.first().row();
1070 if (detailNodeRow < 0)
1077 if (detailNodeRow != selectedRow)
1088 if (fUnselect && selectedRow >= 0) {
1107 QString peerAddrDetails(QString::fromStdString(stats->
nodeStats.
addrName) +
" ");
1108 peerAddrDetails += tr(
"(node id: %1)").arg(QString::number(stats->
nodeStats.
nodeid));
1110 peerAddrDetails +=
"<br />" + tr(
"via %1").arg(QString::fromStdString(stats->
nodeStats.
addrLocal));
1111 ui->peerHeading->setText(peerAddrDetails);
1127 ui->peerPermissions->setText(tr(
"N/A"));
1129 QStringList permissions;
1131 permissions.append(QString::fromStdString(permission));
1133 ui->peerPermissions->setText(permissions.join(
" & "));
1144 ui->peerSyncHeight->setText(tr(
"Unknown"));
1150 ui->peerCommonHeight->setText(tr(
"Unknown"));
1153 ui->detailWidget->show();
1158 QWidget::resizeEvent(event);
1163 QWidget::showEvent(event);
1174 QWidget::hideEvent(event);
1185 QModelIndex index =
ui->peerWidget->indexAt(point);
1186 if (index.isValid())
1192 QModelIndex index =
ui->banlistWidget->indexAt(point);
1193 if (index.isValid())
1201 for(
int i = 0; i < nodes.count(); i++)
1204 NodeId id = nodes.at(i).data().toLongLong();
1218 for(
int i = 0; i < nodes.count(); i++)
1221 NodeId id = nodes.at(i).data().toLongLong();
1225 if (detailNodeRow < 0)
return;
1245 for(
int i = 0; i < nodes.count(); i++)
1248 QString strNode = nodes.at(i).data().toString();
1261 ui->peerWidget->selectionModel()->clearSelection();
1263 ui->detailWidget->hide();
1264 ui->peerHeading->setText(tr(
"Select a peer to view detailed information."));
1273 ui->banlistWidget->setVisible(visible);
1274 ui->banHeading->setVisible(visible);
1279 ui->tabWidget->setCurrentIndex(
int(tabType));
1284 return ui->tabWidget->tabText(
int(tab_type));
1301 this->
ui->label_alerts->setVisible(!warnings.isEmpty());
1302 this->
ui->label_alerts->setText(warnings);
int getRowByNodeId(NodeId nodeid)
const struct @7 ICON_MAPPING[]
void addWallet(WalletModel *const walletModel)
const std::string & get_str() const
QString getDisplayName() const
Local Bitcoin RPC console.
QString cmdBeforeBrowsing
CNodeStateStats nodeStateStats
virtual bool getNetworkActive()=0
Get network active.
static bool isWalletEnabled()
void on_lineEdit_returnPressed()
RPCExecutor(interfaces::Node &node)
QString blocksDir() const
void showPeersTableContextMenu(const QPoint &point)
Show custom context menu on Peers tab.
virtual bool unban(const CSubNet &ip)=0
Unban node.
WalletModel * m_last_wallet_model
virtual UniValue executeRpc(const std::string &command, const UniValue ¶ms, const std::string &uri)=0
Execute rpc command.
virtual void rpcUnsetTimerInterface(RPCTimerInterface *iface)=0
Unset RPC timer interface.
void setClientModel(ClientModel *model=nullptr, int bestblock_height=0, int64_t bestblock_date=0, double verification_progress=0.0)
virtual int64_t getTotalBytesRecv()=0
Get total bytes recv.
interfaces::Node & m_node
void ThreadRename(std::string &&)
Rename a thread both in terms of an internal (in-memory) name as well as its system thread name...
constexpr bool IsDigit(char c)
Tests if the given character is a decimal digit.
int getNumConnections(unsigned int flags=CONNECTIONS_ALL) const
Return number of connections, default is in- and outbound (total)
void setNetworkActive(bool networkActive)
Set network state shown in the UI.
void scrollToEnd()
Scroll console view to end.
QString formatBytes(uint64_t bytes)
QString formatTimeOffset(int64_t nTimeOffset)
void networkActiveChanged(bool networkActive)
std::string write(unsigned int prettyIndent=0, unsigned int indentLevel=0) const
static QString categoryClass(int category)
void clearSelectedNode()
clear the selected node
RPCConsole(interfaces::Node &node, const PlatformStyle *platformStyle, QWidget *parent)
QString HtmlEscape(const QString &str, bool fMultiLine)
QString getWalletName() const
QString formatClientStartupTime() const
PeerTableModel * getPeerTableModel()
void numBlocksChanged(int count, const QDateTime &blockDate, double nVerificationProgress, bool header, SynchronizationState sync_state)
void disconnectSelectedNode()
Disconnect a selected node on the Peers tab.
QString getStatusBarWarnings() const
Return warnings to be displayed in status bar.
void on_tabWidget_currentChanged(int index)
int64_t GetSystemTimeInSeconds()
Returns the system time (not mockable)
void numConnectionsChanged(int count)
virtual bool ban(const CNetAddr &net_addr, int64_t ban_time_offset)=0
Ban node.
void updateNodeDetail(const CNodeCombinedStats *stats)
show detailed information on ui about selected node
interfaces::Node & node() const
virtual void rpcSetTimerInterfaceIfUnset(RPCTimerInterface *iface)=0
Set RPC timer interface if unset.
void alertsChanged(const QString &warnings)
const UniValue & find_value(const UniValue &obj, const std::string &name)
bool LookupSubNet(const std::string &strSubnet, CSubNet &ret)
Parse and resolve a specified subnet string into the appropriate internal representation.
UniValue RPCConvertValues(const std::string &strMethod, const std::vector< std::string > &strParams)
Convert positional arguments to command-specific RPC representation.
void bytesChanged(quint64 totalBytesIn, quint64 totalBytesOut)
const PlatformStyle *const platformStyle
void reply(int category, const QString &command)
QMenu * peersTableContextMenu
void browseHistory(int offset)
Go forward or back in history.
bool fNodeStateStatsAvailable
void resizeEvent(QResizeEvent *event) override
bool push_back(const UniValue &val)
void message(int category, const QString &msg)
Append the message to the message widget.
QString formatPingTime(int64_t ping_usec)
Class for handling RPC timers (used for e.g.
QString formatDurationStr(int secs)
const int CONSOLE_HISTORY
void handleCloseWindowShortcut(QWidget *w)
int atoi(const std::string &str)
void setTabFocus(enum TabTypes tabType)
set which tab has the focus (is visible)
QString formatSubVersion() const
BanTableModel * getBanTableModel()
std::string BerkeleyDatabaseVersion()
void peerLayoutChanged()
Handle updated peer information.
RPCTimerInterface * rpcTimerInterface
virtual bool disconnectByAddress(const CNetAddr &net_addr)=0
Disconnect node by address.
void updateNetworkState()
Update UI with latest network info from model.
const CNodeCombinedStats * getNodeStats(int idx)
QString tabTitle(TabTypes tab_type) const
void on_openDebugLogfileButton_clicked()
open the debug.log from the current datadir
const char * Name() override
Implementation name.
QtRPCTimerBase(std::function< void()> &_func, int64_t millis)
Model for Bitcoin network client.
void unbanSelectedNode()
Unban a selected node on the Bans tab.
ClientModel * clientModel
QMenu * banTableContextMenu
void setTrafficGraphRange(int mins)
void clear(bool clearHistory=true)
void showOrHideBanTableIfRequired()
Hides ban table if no bans are present.
void updateTrafficStats(quint64 totalBytesIn, quint64 totalBytesOut)
update traffic statistics
QList< NodeId > cachedNodeids
void setMempoolSize(long numberOfTxs, size_t dynUsage)
Set size (number of transactions and memory usage) of the mempool in the UI.
void setFontSize(int newSize)
std::function< void()> func
void setNumConnections(int count)
Set number of connections shown in the UI.
const CChainParams & Params()
Return the currently selected parameters.
static bool RPCParseCommandLine(interfaces::Node *node, std::string &strResult, const std::string &strCommand, bool fExecute, std::string *const pstrFilteredOut=nullptr, const WalletModel *wallet_model=nullptr)
Split shell command line into a list of arguments and optionally execute the command(s).
interfaces::Node & m_node
void peerLayoutAboutToChange()
Handle selection caching before update.
Interface to Bitcoin wallet from Qt view code.
virtual std::vector< std::string > listRpcCommands()=0
List rpc commands.
QString formatServicesStr(quint64 mask)
void on_sldGraphRange_valueChanged(int value)
change the time range of the network traffic graph
void banSelectedNode(int bantime)
Ban a selected node on the Peers tab.
void updateAlerts(const QString &warnings)
Opaque base class for timers returned by NewTimerFunc.
void removeWallet(WalletModel *const walletModel)
const int INITIAL_TRAFFIC_GRAPH_MINS
const char fontSizeSettingsKey[]
void peerSelected(const QItemSelection &selected, const QItemSelection &deselected)
Handle selection of peer in peers list.
RPCTimerBase * NewTimer(std::function< void()> &func, int64_t millis) override
Factory function for timers.
void request(const QString &command, const WalletModel *wallet_model)
void mempoolSizeChanged(long count, size_t mempoolSizeInBytes)
const QSize FONT_RANGE(4, 40)
static bool RPCExecuteCommandLine(interfaces::Node &node, std::string &strResult, const std::string &strCommand, std::string *const pstrFilteredOut=nullptr, const WalletModel *wallet_model=nullptr)
NetPermissionFlags m_permissionFlags
virtual bool disconnectById(NodeId id)=0
Disconnect node by id.
void showEvent(QShowEvent *event) override
void cmdRequest(const QString &command, const WalletModel *wallet_model)
QCompleter * autoCompleter
virtual int64_t getTotalBytesSent()=0
Get total bytes sent.
QString formatFullVersion() const
Top-level interface for a bitcoin node (bitcoind process).
QKeySequence tabShortcut(TabTypes tab_type) const
void setNumBlocks(int count, const QDateTime &blockDate, double nVerificationProgress, bool headers)
Set number of blocks and last block date shown in the UI.
void showBanTableContextMenu(const QPoint &point)
Show custom context menu on Bans tab.
void keyPressEvent(QKeyEvent *) override
void hideEvent(QHideEvent *event) override
virtual bool eventFilter(QObject *obj, QEvent *event) override
static std::vector< std::string > ToStrings(NetPermissionFlags flags)
QList< QModelIndex > getEntryData(const QAbstractItemView *view, int column)
Return a field of the currently selected entry as a QString.