10#include <chainparams.h>
29#include <QAbstractButton>
30#include <QAbstractItemModel>
34#include <QKeySequence>
35#include <QLatin1String>
44#include <QStyledItemDelegate>
62 {
"cmd-request",
":/icons/tx_input"},
63 {
"cmd-reply",
":/icons/tx_output"},
64 {
"cmd-error",
":/icons/tx_output"},
65 {
"misc",
":/icons/tx_inout"},
72const QStringList historyFilter = QStringList()
76 <<
"signmessagewithprivkey"
77 <<
"signrawtransactionwithkey"
79 <<
"walletpassphrasechange"
112 timer.setSingleShot(
true);
113 connect(&
timer, &QTimer::timeout, [
this]{
func(); });
126 const char *
Name()
override {
return "Qt"; }
138 : QStyledItemDelegate(parent) {}
140 QString
displayText(
const QVariant& value,
const QLocale& locale)
const override
144 return value.toString() + QLatin1String(
" ");
148#include <qt/rpcconsole.moc>
172 std::vector< std::vector<std::string> > stack;
173 stack.emplace_back();
178 STATE_EATING_SPACES_IN_ARG,
179 STATE_EATING_SPACES_IN_BRACKETS,
184 STATE_ESCAPE_DOUBLEQUOTED,
185 STATE_COMMAND_EXECUTED,
186 STATE_COMMAND_EXECUTED_INNER
187 } state = STATE_EATING_SPACES;
190 unsigned nDepthInsideSensitive = 0;
191 size_t filter_begin_pos = 0, chpos;
192 std::vector<std::pair<size_t, size_t>> filter_ranges;
194 auto add_to_current_stack = [&](
const std::string& strArg) {
195 if (stack.back().empty() && (!nDepthInsideSensitive) && historyFilter.contains(QString::fromStdString(strArg), Qt::CaseInsensitive)) {
196 nDepthInsideSensitive = 1;
197 filter_begin_pos = chpos;
201 stack.emplace_back();
203 stack.back().push_back(strArg);
206 auto close_out_params = [&]() {
207 if (nDepthInsideSensitive) {
208 if (!--nDepthInsideSensitive) {
210 filter_ranges.emplace_back(filter_begin_pos, chpos);
211 filter_begin_pos = 0;
217 std::string strCommandTerminated = strCommand;
218 if (strCommandTerminated.back() !=
'\n')
219 strCommandTerminated +=
"\n";
220 for (chpos = 0; chpos < strCommandTerminated.size(); ++chpos)
222 char ch = strCommandTerminated[chpos];
225 case STATE_COMMAND_EXECUTED_INNER:
226 case STATE_COMMAND_EXECUTED:
228 bool breakParsing =
true;
231 case '[': curarg.clear(); state = STATE_COMMAND_EXECUTED_INNER;
break;
233 if (state == STATE_COMMAND_EXECUTED_INNER)
241 if (curarg.size() && fExecute)
249 throw std::runtime_error(
"Invalid result query");
251 subelement = lastResult[parsed.value()];
256 throw std::runtime_error(
"Invalid result query");
257 lastResult = subelement;
260 state = STATE_COMMAND_EXECUTED;
264 breakParsing =
false;
270 if (lastResult.
isStr())
273 curarg = lastResult.
write(2);
279 add_to_current_stack(curarg);
285 state = STATE_EATING_SPACES;
292 case STATE_EATING_SPACES_IN_ARG:
293 case STATE_EATING_SPACES_IN_BRACKETS:
294 case STATE_EATING_SPACES:
297 case '"': state = STATE_DOUBLEQUOTED;
break;
298 case '\'': state = STATE_SINGLEQUOTED;
break;
299 case '\\': state = STATE_ESCAPE_OUTER;
break;
300 case '(':
case ')':
case '\n':
301 if (state == STATE_EATING_SPACES_IN_ARG)
302 throw std::runtime_error(
"Invalid Syntax");
303 if (state == STATE_ARGUMENT)
305 if (ch ==
'(' && stack.size() && stack.back().size() > 0)
307 if (nDepthInsideSensitive) {
308 ++nDepthInsideSensitive;
310 stack.emplace_back();
315 throw std::runtime_error(
"Invalid Syntax");
317 add_to_current_stack(curarg);
319 state = STATE_EATING_SPACES_IN_BRACKETS;
321 if ((ch ==
')' || ch ==
'\n') && stack.size() > 0)
326 UniValue params =
RPCConvertValues(stack.back()[0], std::vector<std::string>(stack.back().begin() + 1, stack.back().end()));
327 std::string method = stack.back()[0];
331 QByteArray encodedName = QUrl::toPercentEncoding(wallet_model->
getWalletName());
332 uri =
"/wallet/"+std::string(encodedName.constData(), encodedName.length());
336 lastResult =
node->executeRpc(method, params, uri);
339 state = STATE_COMMAND_EXECUTED;
343 case ' ':
case ',':
case '\t':
344 if(state == STATE_EATING_SPACES_IN_ARG && curarg.empty() && ch ==
',')
345 throw std::runtime_error(
"Invalid Syntax");
347 else if(state == STATE_ARGUMENT)
349 add_to_current_stack(curarg);
352 if ((state == STATE_EATING_SPACES_IN_BRACKETS || state == STATE_ARGUMENT) && ch ==
',')
354 state = STATE_EATING_SPACES_IN_ARG;
357 state = STATE_EATING_SPACES;
359 default: curarg += ch; state = STATE_ARGUMENT;
362 case STATE_SINGLEQUOTED:
365 case '\'': state = STATE_ARGUMENT;
break;
366 default: curarg += ch;
369 case STATE_DOUBLEQUOTED:
372 case '"': state = STATE_ARGUMENT;
break;
373 case '\\': state = STATE_ESCAPE_DOUBLEQUOTED;
break;
374 default: curarg += ch;
377 case STATE_ESCAPE_OUTER:
378 curarg += ch; state = STATE_ARGUMENT;
380 case STATE_ESCAPE_DOUBLEQUOTED:
381 if(ch !=
'"' && ch !=
'\\') curarg +=
'\\';
382 curarg += ch; state = STATE_DOUBLEQUOTED;
386 if (pstrFilteredOut) {
387 if (STATE_COMMAND_EXECUTED == state) {
391 *pstrFilteredOut = strCommand;
392 for (
auto i = filter_ranges.rbegin(); i != filter_ranges.rend(); ++i) {
393 pstrFilteredOut->replace(i->first, i->second - i->first,
"(…)");
398 case STATE_COMMAND_EXECUTED:
399 if (lastResult.
isStr())
400 strResult = lastResult.
get_str();
402 strResult = lastResult.
write(2);
405 case STATE_EATING_SPACES:
417 std::string executableCommand =
command.toStdString() +
"\n";
420 if(executableCommand ==
"help-console\n") {
422 "This console accepts RPC commands using the standard syntax.\n"
423 " example: getblockhash 0\n\n"
425 "This console can also accept RPC commands using the parenthesized syntax.\n"
426 " example: getblockhash(0)\n\n"
428 "Commands may be nested when specified with the parenthesized syntax.\n"
429 " example: getblock(getblockhash(0) 1)\n\n"
431 "A space or a comma can be used to delimit arguments for either syntax.\n"
432 " example: getblockhash 0\n"
433 " getblockhash,0\n\n"
435 "Named results can be queried with a non-quoted key string in brackets using the parenthesized syntax.\n"
436 " example: getblock(getblockhash(0) 1)[tx]\n\n"
438 "Results without keys can be queried with an integer in brackets using the parenthesized syntax.\n"
439 " example: getblock(getblockhash(0),1)[tx][0]\n\n")));
457 catch (
const std::runtime_error&)
462 catch (
const std::exception& e)
472 platformStyle(_platformStyle)
479 if (!restoreGeometry(settings.value(
"RPCConsoleWindowGeometry").toByteArray())) {
481 move(QGuiApplication::primaryScreen()->availableGeometry().center() - frameGeometry().center());
483 ui->
splitter->restoreState(settings.value(
"RPCConsoleWindowPeersTabSplitterSizes").toByteArray());
488 ui->
splitter->restoreState(settings.value(
"RPCConsoleWidgetPeersTabSplitterSizes").toByteArray());
494 constexpr QChar nonbreaking_hyphen(8209);
497 tr(
"Inbound: initiated by peer"),
501 tr(
"Outbound Full Relay: default"),
504 tr(
"Outbound Block Relay: does not relay transactions or addresses"),
509 tr(
"Outbound Manual: added using RPC %1 or %2/%3 configuration options")
511 .arg(QString(nonbreaking_hyphen) +
"addnode")
512 .arg(QString(nonbreaking_hyphen) +
"connect"),
515 tr(
"Outbound Feeler: short-lived, for testing addresses"),
518 tr(
"Outbound Address Fetch: short-lived, for soliciting addresses")};
519 const QString connection_types_list{
"<ul><li>" + Join(
CONNECTION_TYPE_DOC, QString(
"</li><li>")) +
"</li></ul>"};
523 tr(
"detecting: peer could be v1 or v2"),
525 tr(
"v1: unencrypted, plaintext transport protocol"),
527 tr(
"v2: BIP324 encrypted transport protocol")};
528 const QString transport_types_list{
"<ul><li>" + Join(
TRANSPORT_TYPE_DOC, QString(
"</li><li>")) +
"</li></ul>"};
530 const QString hb_list{
"<ul><li>\""
531 +
ts.
to +
"\" – " + tr(
"we selected the peer for high bandwidth relay") +
"</li><li>\""
532 +
ts.
from +
"\" – " + tr(
"the peer selected us for high bandwidth relay") +
"</li><li>\""
533 +
ts.
no +
"\" – " + tr(
"no high bandwidth relay selected") +
"</li></ul>"};
535 ui->
dataDir->setToolTip(
ui->
dataDir->toolTip().arg(QString(nonbreaking_hyphen) +
"datadir"));
564 connect(
ui->
clearButton, &QAbstractButton::clicked, [
this] { clear(); });
596 settings.setValue(
"RPCConsoleWindowGeometry", saveGeometry());
597 settings.setValue(
"RPCConsoleWindowPeersTabSplitterSizes",
ui->
splitter->saveState());
602 settings.setValue(
"RPCConsoleWidgetPeersTabSplitterSizes",
ui->
splitter->saveState());
615 if(event->type() == QEvent::KeyPress)
617 QKeyEvent *keyevt =
static_cast<QKeyEvent*
>(event);
618 int key = keyevt->key();
619 Qt::KeyboardModifiers mod = keyevt->modifiers();
625 case Qt::Key_PageDown:
635 QApplication::sendEvent(
ui->
lineEdit, keyevt);
644 (!mod && !keyevt->text().isEmpty() && key != Qt::Key_Tab) ||
645 ((mod & Qt::ControlModifier) && key == Qt::Key_V) ||
646 ((mod & Qt::ShiftModifier) && key == Qt::Key_Insert)))
649 QApplication::sendEvent(
ui->
lineEdit, keyevt);
654 return QWidget::eventFilter(obj, event);
661 bool wallet_enabled{
false};
665 if (model && !wallet_enabled) {
692 ui->
peerWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
693 ui->
peerWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
694 ui->
peerWidget->setContextMenuPolicy(Qt::CustomContextMenu);
702 ui->
peerWidget->horizontalHeader()->setStretchLastSection(
true);
721 connect(model->
getPeerTableModel(), &QAbstractItemModel::dataChanged, [
this] { updateDetailWidget(); });
726 ui->
banlistWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
727 ui->
banlistWidget->setSelectionMode(QAbstractItemView::SingleSelection);
764 QStringList wordList;
766 for (
size_t i = 0; i < commandList.size(); ++i)
768 wordList << commandList[i].c_str();
769 wordList << (
"help " + commandList[i]).c_str();
772 wordList <<
"help-console";
775 autoCompleter->setModelSorting(QCompleter::CaseSensitivelySortedModel);
792void RPCConsole::addWallet(
WalletModel *
const walletModel)
806void RPCConsole::removeWallet(
WalletModel *
const walletModel)
815void RPCConsole::setCurrentWallet(
WalletModel*
const wallet_model)
817 QVariant data = QVariant::fromValue(wallet_model);
829 default:
return "misc";
855 str.replace(QString(
"font-size:%1pt").arg(
consoleFontSize), QString(
"font-size:%1pt").arg(newSize));
879 QTextDocument::ImageResource,
893 "td.time { color: #808080; font-size: %2; padding-top: 3px; } "
894 "td.message { font-family: %1; font-size: %2; white-space:pre-wrap; } "
895 "td.cmd-request { color: #006060; } "
896 "td.cmd-error { color: red; } "
897 ".secwarning { color: red; }"
898 "b { color: #006060; } "
902 static const QString welcome_message =
906 tr(
"Welcome to the %1 RPC console.\n"
907 "Use up and down arrows to navigate history, and %2 to clear screen.\n"
908 "Use %3 and %4 to increase or decrease the font size.\n"
909 "Type %5 for an overview of available commands.\n"
910 "For more information on using this console, type %6.\n"
912 "%7WARNING: Scammers have been active, telling users to type"
913 " commands here, stealing their wallet contents. Do not use this console"
914 " without fully understanding the ramifications of a command.%8")
916 "<b>" +
ui->
clearButton->shortcut().toString(QKeySequence::NativeText) +
"</b>",
920 "<b>help-console</b>",
921 "<span class=\"secwarning\">",
936 if (e->type() == QEvent::PaletteChange) {
944 QTextDocument::ImageResource,
950 QWidget::changeEvent(e);
955 QTime time = QTime::currentTime();
956 QString timeString = time.toString();
958 out +=
"<table><tr><td class=\"time\" width=\"65\">" + timeString +
"</td>";
959 out +=
"<td class=\"icon\" width=\"32\"><img src=\"" +
categoryClass(category) +
"\"></td>";
960 out +=
"<td class=\"message " +
categoryClass(category) +
"\" valign=\"middle\">";
965 out +=
"</td></tr></table>";
977 connections +=
" (" + tr(
"Network activity disabled") +
")";
982 QString local_addresses;
984 for (
const auto& [addr, info] : hosts) {
985 local_addresses += QString::fromStdString(addr.ToStringAddr());
986 if (!addr.IsI2P()) local_addresses +=
":" + QString::number(info.nPort);
987 local_addresses +=
", ";
989 local_addresses.chop(2);
990 if (local_addresses.isEmpty()) local_addresses = tr(
"None");
1020 const auto cur_usage_str = dynUsage < 1000000 ?
1021 QObject::tr(
"%1 kB").arg(dynUsage / 1000.0, 0,
'f', 2) :
1022 QObject::tr(
"%1 MB").arg(dynUsage / 1000000.0, 0,
'f', 2);
1023 const auto max_usage_str = QObject::tr(
"%1 MB").arg(maxUsage / 1000000.0, 0,
'f', 2);
1025 ui->
mempoolSize->setText(cur_usage_str +
" / " + max_usage_str);
1032 if (
cmd.isEmpty()) {
1036 std::string strFilteredCmd;
1041 throw std::runtime_error(
"Invalid command line");
1043 }
catch (
const std::exception& e) {
1044 QMessageBox::critical(
this,
"Error", QString(
"Error: ") + QString::fromStdString(e.what()));
1049 if (
cmd == QLatin1String(
"stop")) {
1080 QMetaObject::invokeMethod(
m_executor, [
this,
cmd, wallet_model] {
1084 cmd = QString::fromStdString(strFilteredCmd);
1137 connect(&
thread, &QThread::finished,
m_executor, &RPCExecutor::deleteLater);
1162 scrollbar->setValue(scrollbar->maximum());
1167 const int multiplier = 5;
1168 int mins = value * multiplier;
1189 ui->
peerHeading->setText(tr(
"Select a peer to view detailed information."));
1194 QString peerAddrDetails(QString::fromStdString(stats->nodeStats.m_addr_name) +
" ");
1195 peerAddrDetails += tr(
"(peer: %1)").arg(QString::number(stats->nodeStats.nodeid));
1196 if (!stats->nodeStats.addrLocal.empty())
1197 peerAddrDetails +=
"<br />" + tr(
"via %1").arg(QString::fromStdString(stats->nodeStats.addrLocal));
1199 QString bip152_hb_settings;
1200 if (stats->nodeStats.m_bip152_highbandwidth_to) bip152_hb_settings =
ts.
to;
1201 if (stats->nodeStats.m_bip152_highbandwidth_from) bip152_hb_settings += (bip152_hb_settings.isEmpty() ?
ts.
from : QLatin1Char(
'/') +
ts.
from);
1202 if (bip152_hb_settings.isEmpty()) bip152_hb_settings =
ts.
no;
1214 if (stats->nodeStats.nVersion) {
1215 ui->
peerVersion->setText(QString::number(stats->nodeStats.nVersion));
1217 if (!stats->nodeStats.cleanSubVer.empty()) {
1218 ui->
peerSubversion->setText(QString::fromStdString(stats->nodeStats.cleanSubVer));
1225 ui->
peerSessionId->setText(QString::fromStdString(stats->nodeStats.m_session_id));
1234 QStringList permissions;
1236 permissions.append(QString::fromStdString(permission));
1240 ui->
peerMappedAS->setText(stats->nodeStats.m_mapped_as != 0 ? QString::number(stats->nodeStats.m_mapped_as) :
ts.
na);
1244 if (stats->fNodeStateStatsAvailable) {
1248 if (stats->nodeStateStats.nSyncHeight > -1) {
1249 ui->
peerSyncHeight->setText(QString(
"%1").arg(stats->nodeStateStats.nSyncHeight));
1254 if (stats->nodeStateStats.nCommonHeight > -1) {
1255 ui->
peerCommonHeight->setText(QString(
"%1").arg(stats->nodeStateStats.nCommonHeight));
1259 ui->
peerHeight->setText(QString::number(stats->nodeStateStats.m_starting_height));
1273 QWidget::resizeEvent(event);
1278 QWidget::showEvent(event);
1294 QWidget::hideEvent(event);
1306 if (index.isValid())
1313 if (index.isValid())
1321 for(
int i = 0; i < nodes.count(); i++)
1324 NodeId id = nodes.at(i).data().toLongLong();
1340 m_node.
ban(stats->nodeStats.addr, bantime);
1356 bool unbanned{
false};
1357 for (
const auto& node_index : nodes) {
1358 unbanned |= ban_table_model->unban(node_index);
1361 ban_table_model->refresh();
1415 const QString chainType = QString::fromStdString(
Params().GetChainTypeString());
1416 const QString title = tr(
"Node window - [%1]").arg(chainType);
1417 this->setWindowTitle(title);
const CChainParams & Params()
Return the currently selected parameters.
Qt model providing information about banned peers, similar to the "getpeerinfo" RPC call.
ChainType GetChainType() const
Return the chain type.
Model for Bitcoin network client.
void bytesChanged(quint64 totalBytesIn, quint64 totalBytesOut)
QString blocksDir() const
QString getStatusBarWarnings() const
Return warnings to be displayed in status bar.
std::map< CNetAddr, LocalServiceInfo > getNetLocalAddresses() const
PeerTableModel * getPeerTableModel()
PeerTableSortProxy * peerTableSortProxy()
void numConnectionsChanged(int count)
QString formatClientStartupTime() const
int getNumConnections(unsigned int flags=CONNECTIONS_ALL) const
Return number of connections, default is in- and outbound (total)
BanTableModel * getBanTableModel()
void numBlocksChanged(int count, const QDateTime &blockDate, double nVerificationProgress, SyncType header, SynchronizationState sync_state)
void alertsChanged(const QString &warnings)
void mempoolSizeChanged(long count, size_t mempoolSizeInBytes, size_t mempoolMaxSizeInBytes)
QString formatFullVersion() const
QString formatSubVersion() const
void networkActiveChanged(bool networkActive)
interfaces::Node & node() const
static std::vector< std::string > ToStrings(NetPermissionFlags flags)
QString displayText(const QVariant &value, const QLocale &locale) const override
PeerIdViewDelegate(QObject *parent=nullptr)
Class for handling RPC timers (used for e.g.
std::function< void()> func
QtRPCTimerBase(std::function< void()> &_func, int64_t millis)
~QtRPCTimerBase()=default
const char * Name() override
Implementation name.
RPCTimerBase * NewTimer(std::function< void()> &func, int64_t millis) override
Factory function for timers.
~QtRPCTimerInterface()=default
Local Bitcoin RPC console.
QMenu * peersTableContextMenu
RPCConsole(interfaces::Node &node, const PlatformStyle *platformStyle, QWidget *parent)
struct RPCConsole::TranslatedStrings ts
void browseHistory(int offset)
Go forward or back in history.
QByteArray m_banlist_widget_header_state
RPCTimerInterface * rpcTimerInterface
QString TimeDurationField(std::chrono::seconds time_now, std::chrono::seconds time_at_event) const
Helper for the output of a time duration field.
void on_lineEdit_returnPressed()
void message(int category, const QString &msg)
Append the message to the message widget.
void setFontSize(int newSize)
void updateTrafficStats(quint64 totalBytesIn, quint64 totalBytesOut)
update traffic statistics
void setTrafficGraphRange(int mins)
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).
const PlatformStyle *const platformStyle
void setMempoolSize(long numberOfTxs, size_t dynUsage, size_t maxUsage)
Set size (number of transactions and memory usage) of the mempool in the UI.
void updateDetailWidget()
show detailed information on ui about selected node
void showEvent(QShowEvent *event) override
void resizeEvent(QResizeEvent *event) override
static bool RPCExecuteCommandLine(interfaces::Node &node, std::string &strResult, const std::string &strCommand, std::string *const pstrFilteredOut=nullptr, const WalletModel *wallet_model=nullptr)
QString tabTitle(TabTypes tab_type) const
void updateNetworkState()
Update UI with latest network info from model.
void clear(bool keep_prompt=false)
void disconnectSelectedNode()
Disconnect a selected node on the Peers tab.
@ SUBVERSION_COLUMN_WIDTH
QCompleter * autoCompleter
void hideEvent(QHideEvent *event) override
QKeySequence tabShortcut(TabTypes tab_type) const
void showPeersTableContextMenu(const QPoint &point)
Show custom context menu on Peers tab.
QList< NodeId > cachedNodeids
interfaces::Node & m_node
void unbanSelectedNode()
Unban a selected node on the Bans tab.
void updateAlerts(const QString &warnings)
void clearSelectedNode()
clear the selected node
void on_sldGraphRange_valueChanged(int value)
change the time range of the network traffic graph
void setNumConnections(int count)
Set number of connections shown in the UI.
void setNumBlocks(int count, const QDateTime &blockDate, double nVerificationProgress, SyncType synctype)
Set number of blocks and last block date shown in the UI.
ClientModel * clientModel
void banSelectedNode(int bantime)
Ban a selected node on the Peers tab.
void scrollToEnd()
Scroll console view to end.
void keyPressEvent(QKeyEvent *) override
void on_tabWidget_currentChanged(int index)
void setNetworkActive(bool networkActive)
Set network state shown in the UI.
QString cmdBeforeBrowsing
virtual bool eventFilter(QObject *obj, QEvent *event) override
void on_openDebugLogfileButton_clicked()
open the debug.log from the current datadir
void showBanTableContextMenu(const QPoint &point)
Show custom context menu on Bans tab.
void setClientModel(ClientModel *model=nullptr, int bestblock_height=0, int64_t bestblock_date=0, double verification_progress=0.0)
void setTabFocus(enum TabTypes tabType)
set which tab has the focus (is visible)
QByteArray m_peer_widget_header_state
void changeEvent(QEvent *e) override
WalletModel * m_last_wallet_model
void showOrHideBanTableIfRequired()
Hides ban table if no bans are present.
QMenu * banTableContextMenu
void reply(int category, const QString &command)
RPCExecutor(interfaces::Node &node)
interfaces::Node & m_node
void request(const QString &command, const WalletModel *wallet_model)
Opaque base class for timers returned by NewTimerFunc.
QLabel * peerConnectionTypeLabel
QWidget * peersTabRightPanel
QPushButton * openDebugLogfileButton
QToolButton * fontBiggerButton
TrafficGraphWidget * trafficGraph
QTableView * banlistWidget
QLabel * peerHighBandwidthLabel
QComboBox * WalletSelector
QLabel * numberOfConnections
QLabel * peerTransportType
QLabel * peerTransportTypeLabel
QLabel * WalletSelectorLabel
QLabel * peerSessionIdLabel
QPushButton * btnClearTrafficGraph
QLabel * peerCommonHeight
QLabel * peerHighBandwidth
QLabel * peerAddrRateLimited
QToolButton * fontSmallerButton
QLabel * peerConnectionType
void setupUi(QWidget *RPCConsole)
QToolButton * clearButton
QLabel * peerAddrRelayEnabled
QLabel * mempoolNumberTxs
QTextEdit * messagesWidget
QLabel * peerAddrProcessed
QToolButton * hidePeersDetailButton
const std::string & get_str() const
const UniValue & find_value(std::string_view key) const
std::string write(unsigned int prettyIndent=0, unsigned int indentLevel=0) const
Interface to Bitcoin wallet from Qt view code.
QString getDisplayName() const
static bool isWalletEnabled()
QString getWalletName() const
Top-level interface for a bitcoin node (bitcoind process).
virtual void rpcSetTimerInterfaceIfUnset(RPCTimerInterface *iface)=0
Set RPC timer interface if unset.
virtual bool disconnectById(NodeId id)=0
Disconnect node by id.
virtual bool ban(const CNetAddr &net_addr, int64_t ban_time_offset)=0
Ban node.
virtual std::vector< std::string > listRpcCommands()=0
List rpc commands.
virtual void rpcUnsetTimerInterface(RPCTimerInterface *iface)=0
Unset RPC timer interface.
virtual bool getNetworkActive()=0
Get network active.
virtual bool disconnectByAddress(const CNetAddr &net_addr)=0
Disconnect node by address.
UniValue RPCConvertValues(const std::string &strMethod, const std::vector< std::string > &strParams)
Convert positional arguments to command-specific RPC representation.
std::string TransportTypeAsString(TransportProtocolType transport_type)
Convert TransportProtocolType enum to a string value.
QString NetworkToQString(Network net)
Convert enum Network to QString.
QString HtmlEscape(const QString &str, bool fMultiLine)
QList< QModelIndex > getEntryData(const QAbstractItemView *view, int column)
Return a field of the currently selected entry as a QString.
QFont fixedPitchFont(bool use_embedded_font)
QString formatBytes(uint64_t bytes)
QString formatDurationStr(std::chrono::seconds dur)
Convert seconds into a QString with days, hours, mins, secs.
void AddButtonShortcut(QAbstractButton *button, const QKeySequence &shortcut)
Connects an additional shortcut to a QAbstractButton.
void handleCloseWindowShortcut(QWidget *w)
void copyEntryData(const QAbstractItemView *view, int column, int role)
Copy a field of the currently selected entry of a view to the clipboard.
QString formatPingTime(std::chrono::microseconds ping_time)
Format a CNodeStats.m_last_ping_time into a user-readable string or display N/A, if 0.
QString ConnectionTypeToQString(ConnectionType conn_type, bool prepend_direction)
Convert enum ConnectionType to QString.
QString formatServicesStr(quint64 mask)
Format CNodeStats.nServices bitmask into a user-readable string.
QString formatTimeOffset(int64_t time_offset)
Format a CNodeStateStats.time_offset into a user-readable string.
bool IsEscapeOrBack(int key)
void ThreadRename(const std::string &)
Rename a thread both in terms of an internal (in-memory) name as well as its system thread name.
auto Join(const C &container, const S &separator, UnaryOp unary_op)
Join all container items.
const std::vector< std::string > CONNECTION_TYPE_DOC
const std::vector< std::string > TRANSPORT_TYPE_DOC
const int INITIAL_TRAFFIC_GRAPH_MINS
const struct @8 ICON_MAPPING[]
const QSize FONT_RANGE(4, 40)
const int CONSOLE_HISTORY
static QString categoryClass(int category)
const char fontSizeSettingsKey[]
std::optional< T > ToIntegral(std::string_view str)
Convert string to integral type T.
int64_t GetTime()
DEPRECATED Use either ClockType::now() or Now<TimePointType>() if a cast is needed.
constexpr auto Ticks(Dur2 d)
Helper to count the seconds of a duration/time_point.