Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Slots | Private Member Functions | Private Attributes | List of all members
RPCConsole Class Reference

Local Bitcoin RPC console. More...

#include <rpcconsole.h>

Inheritance diagram for RPCConsole:
[legend]
Collaboration diagram for RPCConsole:
[legend]

Public Types

enum  MessageClass {
  MC_ERROR , MC_DEBUG , CMD_REQUEST , CMD_REPLY ,
  CMD_ERROR
}
 
enum class  TabTypes { INFO , CONSOLE , GRAPH , PEERS }
 

Public Slots

void clear (bool clearHistory=true)
 
void fontBigger ()
 
void fontSmaller ()
 
void setFontSize (int newSize)
 
void message (int category, const QString &msg)
 Append the message to the message widget.
 
void message (int category, const QString &message, bool html)
 
void setNumConnections (int count)
 Set number of connections shown in the UI.
 
void setNetworkActive (bool networkActive)
 Set network state 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.
 
void setMempoolSize (long numberOfTxs, size_t dynUsage)
 Set size (number of transactions and memory usage) of the mempool in the UI.
 
void browseHistory (int offset)
 Go forward or back in history.
 
void scrollToEnd ()
 Scroll console view to end.
 
void peerLayoutAboutToChange ()
 Handle selection caching before update.
 
void peerLayoutChanged ()
 Handle updated peer information.
 
void disconnectSelectedNode ()
 Disconnect a selected node on the Peers tab.
 
void banSelectedNode (int bantime)
 Ban a selected node on the Peers tab.
 
void unbanSelectedNode ()
 Unban a selected node on the Bans tab.
 
void setTabFocus (enum TabTypes tabType)
 set which tab has the focus (is visible)
 

Signals

void cmdRequest (const QString &command, const WalletModel *wallet_model)
 

Public Member Functions

 RPCConsole (interfaces::Node &node, const PlatformStyle *platformStyle, QWidget *parent)
 
 ~RPCConsole ()
 
void setClientModel (ClientModel *model=nullptr, int bestblock_height=0, int64_t bestblock_date=0, double verification_progress=0.0)
 
void addWallet (WalletModel *const walletModel)
 
void removeWallet (WalletModel *const walletModel)
 
std::vector< TabTypestabs () const
 
QString tabTitle (TabTypes tab_type) const
 
QKeySequence tabShortcut (TabTypes tab_type) const
 

Static Public Member Functions

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).
 
static bool RPCExecuteCommandLine (interfaces::Node &node, std::string &strResult, const std::string &strCommand, std::string *const pstrFilteredOut=nullptr, const WalletModel *wallet_model=nullptr)
 

Protected Member Functions

virtual bool eventFilter (QObject *obj, QEvent *event) override
 
void keyPressEvent (QKeyEvent *) override
 

Private Types

enum  ColumnWidths {
  ADDRESS_COLUMN_WIDTH = 200 , SUBVERSION_COLUMN_WIDTH = 150 , PING_COLUMN_WIDTH = 80 , BANSUBNET_COLUMN_WIDTH = 200 ,
  BANTIME_COLUMN_WIDTH = 250
}
 

Private Slots

void on_lineEdit_returnPressed ()
 
void on_tabWidget_currentChanged (int index)
 
void on_openDebugLogfileButton_clicked ()
 open the debug.log from the current datadir
 
void on_sldGraphRange_valueChanged (int value)
 change the time range of the network traffic graph
 
void updateTrafficStats (quint64 totalBytesIn, quint64 totalBytesOut)
 update traffic statistics
 
void resizeEvent (QResizeEvent *event) override
 
void showEvent (QShowEvent *event) override
 
void hideEvent (QHideEvent *event) override
 
void showPeersTableContextMenu (const QPoint &point)
 Show custom context menu on Peers tab.
 
void showBanTableContextMenu (const QPoint &point)
 Show custom context menu on Bans tab.
 
void showOrHideBanTableIfRequired ()
 Hides ban table if no bans are present.
 
void clearSelectedNode ()
 clear the selected node
 
void updateDetailWidget ()
 show detailed information on ui about selected node
 
void updateAlerts (const QString &warnings)
 

Private Member Functions

void startExecutor ()
 
void setTrafficGraphRange (int mins)
 
void updateNetworkState ()
 Update UI with latest network info from model.
 
QString TimeDurationField (std::chrono::seconds time_now, std::chrono::seconds time_at_event) const
 Helper for the output of a time duration field.
 

Private Attributes

interfaces::Nodem_node
 
Ui::RPCConsole *const ui
 
ClientModelclientModel = nullptr
 
QStringList history
 
int historyPtr = 0
 
QString cmdBeforeBrowsing
 
QList< NodeIdcachedNodeids
 
const PlatformStyle *const platformStyle
 
RPCTimerInterfacerpcTimerInterface = nullptr
 
QMenupeersTableContextMenu = nullptr
 
QMenubanTableContextMenu = nullptr
 
int consoleFontSize = 0
 
QCompleterautoCompleter = nullptr
 
QThread thread
 
WalletModelm_last_wallet_model {nullptr}
 

Detailed Description

Local Bitcoin RPC console.

Definition at line 36 of file rpcconsole.h.

Member Enumeration Documentation

◆ ColumnWidths

Enumerator
ADDRESS_COLUMN_WIDTH 
SUBVERSION_COLUMN_WIDTH 
PING_COLUMN_WIDTH 
BANSUBNET_COLUMN_WIDTH 
BANTIME_COLUMN_WIDTH 

Definition at line 148 of file rpcconsole.h.

◆ MessageClass

Enumerator
MC_ERROR 
MC_DEBUG 
CMD_REQUEST 
CMD_REPLY 
CMD_ERROR 

Definition at line 64 of file rpcconsole.h.

◆ TabTypes

Enumerator
INFO 
CONSOLE 
GRAPH 
PEERS 

Definition at line 66 of file rpcconsole.h.

Constructor & Destructor Documentation

◆ RPCConsole()

RPCConsole::RPCConsole ( interfaces::Node node,
const PlatformStyle platformStyle,
QWidget *  parent 
)
explicit

Definition at line 509 of file rpcconsole.cpp.

Here is the call graph for this function:

◆ ~RPCConsole()

RPCConsole::~RPCConsole ( )

Definition at line 590 of file rpcconsole.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ addWallet()

void RPCConsole::addWallet ( WalletModel *const  walletModel)

◆ banSelectedNode

void RPCConsole::banSelectedNode ( int  bantime)
slot

Ban a selected node on the Peers tab.

Definition at line 1412 of file rpcconsole.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ browseHistory

void RPCConsole::browseHistory ( int  offset)
slot

Go forward or back in history.

Definition at line 1105 of file rpcconsole.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clear

void RPCConsole::clear ( bool  clearHistory = true)
slot

Definition at line 910 of file rpcconsole.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearSelectedNode

void RPCConsole::clearSelectedNode ( )
privateslot

clear the selected node

Definition at line 1463 of file rpcconsole.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cmdRequest

void RPCConsole::cmdRequest ( const QString command,
const WalletModel wallet_model 
)
signal
Here is the caller graph for this function:

◆ disconnectSelectedNode

void RPCConsole::disconnectSelectedNode ( )
slot

Disconnect a selected node on the Peers tab.

Definition at line 1398 of file rpcconsole.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ eventFilter()

bool RPCConsole::eventFilter ( QObject *  obj,
QEvent event 
)
overrideprotectedvirtual

Definition at line 598 of file rpcconsole.cpp.

Here is the call graph for this function:

◆ fontBigger

void RPCConsole::fontBigger ( )
slot

Definition at line 872 of file rpcconsole.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fontSmaller

void RPCConsole::fontSmaller ( )
slot

Definition at line 876 of file rpcconsole.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hideEvent

void RPCConsole::hideEvent ( QHideEvent event)
overrideprivateslot

Definition at line 1373 of file rpcconsole.cpp.

Here is the call graph for this function:

◆ keyPressEvent()

void RPCConsole::keyPressEvent ( QKeyEvent event)
overrideprotected

Definition at line 969 of file rpcconsole.cpp.

Here is the call graph for this function:

◆ message [1/2]

void RPCConsole::message ( int  category,
const QString message,
bool  html 
)
slot

Definition at line 975 of file rpcconsole.cpp.

Here is the call graph for this function:

◆ message [2/2]

void RPCConsole::message ( int  category,
const QString msg 
)
inlineslot

Append the message to the message widget.

Definition at line 109 of file rpcconsole.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_lineEdit_returnPressed

void RPCConsole::on_lineEdit_returnPressed ( )
privateslot

Definition at line 1044 of file rpcconsole.cpp.

Here is the call graph for this function:

◆ on_openDebugLogfileButton_clicked

void RPCConsole::on_openDebugLogfileButton_clicked ( )
privateslot

open the debug.log from the current datadir

Definition at line 1155 of file rpcconsole.cpp.

Here is the call graph for this function:

◆ on_sldGraphRange_valueChanged

void RPCConsole::on_sldGraphRange_valueChanged ( int  value)
privateslot

change the time range of the network traffic graph

Definition at line 1164 of file rpcconsole.cpp.

Here is the call graph for this function:

◆ on_tabWidget_currentChanged

void RPCConsole::on_tabWidget_currentChanged ( int  index)
privateslot

Definition at line 1149 of file rpcconsole.cpp.

◆ peerLayoutAboutToChange

void RPCConsole::peerLayoutAboutToChange ( )
slot

Handle selection caching before update.

Definition at line 1182 of file rpcconsole.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ peerLayoutChanged

void RPCConsole::peerLayoutChanged ( )
slot

Handle updated peer information.

Definition at line 1194 of file rpcconsole.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeWallet()

void RPCConsole::removeWallet ( WalletModel *const  walletModel)

◆ resizeEvent

void RPCConsole::resizeEvent ( QResizeEvent event)
overrideprivateslot

Definition at line 1358 of file rpcconsole.cpp.

◆ RPCExecuteCommandLine()

static bool RPCConsole::RPCExecuteCommandLine ( interfaces::Node node,
std::string &  strResult,
const std::string &  strCommand,
std::string *const  pstrFilteredOut = nullptr,
const WalletModel wallet_model = nullptr 
)
inlinestatic

Definition at line 50 of file rpcconsole.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RPCParseCommandLine()

bool RPCConsole::RPCParseCommandLine ( interfaces::Node node,
std::string &  strResult,
const std::string &  strCommand,
bool  fExecute,
std::string *const  pstrFilteredOut = nullptr,
const WalletModel wallet_model = nullptr 
)
static

Split shell command line into a list of arguments and optionally execute the command(s).

Aims to emulate bash and friends.

  • Command nesting is possible with parenthesis; for example: validateaddress(getnewaddress())
  • Arguments are delimited with whitespace or comma
  • Extra whitespace at the beginning and end and between arguments will be ignored
  • Text can be "double" or 'single' quoted
  • The backslash \ is used as escape character
    • Outside quotes, any character can be escaped
    • Within double quotes, only escape " and backslashes before a \c " or another backslash
    • Within single quotes, no escaping is possible and no special interpretation takes place
Parameters
[in]nodeoptional node to execute command on
[out]strResultstringified result from the executed command(chain)
[in]strCommandCommand line to split
[in]fExecuteset true if you want the command to be executed
[out]pstrFilteredOutCommand line, filtered to remove any sensitive data

Definition at line 146 of file rpcconsole.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ scrollToEnd

void RPCConsole::scrollToEnd ( )
slot

Scroll console view to end.

Definition at line 1159 of file rpcconsole.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setClientModel()

void RPCConsole::setClientModel ( ClientModel model = nullptr,
int  bestblock_height = 0,
int64_t  bestblock_date = 0,
double  verification_progress = 0.0 
)

Definition at line 653 of file rpcconsole.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setFontSize

void RPCConsole::setFontSize ( int  newSize)
slot

Definition at line 880 of file rpcconsole.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setMempoolSize

void RPCConsole::setMempoolSize ( long  numberOfTxs,
size_t  dynUsage 
)
slot

Set size (number of transactions and memory usage) of the mempool in the UI.

Definition at line 1032 of file rpcconsole.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setNetworkActive

void RPCConsole::setNetworkActive ( bool  networkActive)
slot

Set network state shown in the UI.

Definition at line 1020 of file rpcconsole.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setNumBlocks

void RPCConsole::setNumBlocks ( int  count,
const QDateTime blockDate,
double  nVerificationProgress,
SyncType  synctype 
)
slot

Set number of blocks and last block date shown in the UI.

Definition at line 1024 of file rpcconsole.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setNumConnections

void RPCConsole::setNumConnections ( int  count)
slot

Set number of connections shown in the UI.

Definition at line 1012 of file rpcconsole.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setTabFocus

void RPCConsole::setTabFocus ( enum TabTypes  tabType)
slot

set which tab has the focus (is visible)

Definition at line 1479 of file rpcconsole.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setTrafficGraphRange()

void RPCConsole::setTrafficGraphRange ( int  mins)
private

Definition at line 1170 of file rpcconsole.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ showBanTableContextMenu

void RPCConsole::showBanTableContextMenu ( const QPoint point)
privateslot

Show custom context menu on Bans tab.

Definition at line 1391 of file rpcconsole.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ showEvent

void RPCConsole::showEvent ( QShowEvent event)
overrideprivateslot

Definition at line 1362 of file rpcconsole.cpp.

Here is the call graph for this function:

◆ showOrHideBanTableIfRequired

void RPCConsole::showOrHideBanTableIfRequired ( )
privateslot

Hides ban table if no bans are present.

Definition at line 1469 of file rpcconsole.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ showPeersTableContextMenu

void RPCConsole::showPeersTableContextMenu ( const QPoint point)
privateslot

Show custom context menu on Peers tab.

Definition at line 1384 of file rpcconsole.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ startExecutor()

void RPCConsole::startExecutor ( )
private

Definition at line 1127 of file rpcconsole.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tabs()

std::vector< TabTypes > RPCConsole::tabs ( ) const
inline

Definition at line 68 of file rpcconsole.h.

Here is the caller graph for this function:

◆ tabShortcut()

QKeySequence RPCConsole::tabShortcut ( TabTypes  tab_type) const

Definition at line 1487 of file rpcconsole.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tabTitle()

QString RPCConsole::tabTitle ( TabTypes  tab_type) const

Definition at line 1483 of file rpcconsole.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TimeDurationField()

QString RPCConsole::TimeDurationField ( std::chrono::seconds  time_now,
std::chrono::seconds  time_at_event 
) const
inlineprivate

Helper for the output of a time duration field.

Inputs are UNIX epoch times.

Definition at line 180 of file rpcconsole.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ unbanSelectedNode

void RPCConsole::unbanSelectedNode ( )
slot

Unban a selected node on the Bans tab.

Definition at line 1443 of file rpcconsole.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateAlerts

void RPCConsole::updateAlerts ( const QString warnings)
privateslot

Definition at line 1502 of file rpcconsole.cpp.

Here is the caller graph for this function:

◆ updateDetailWidget

void RPCConsole::updateDetailWidget ( )
privateslot

show detailed information on ui about selected node

Definition at line 1246 of file rpcconsole.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateNetworkState()

void RPCConsole::updateNetworkState ( )
private

Update UI with latest network info from model.

Definition at line 993 of file rpcconsole.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateTrafficStats

void RPCConsole::updateTrafficStats ( quint64  totalBytesIn,
quint64  totalBytesOut 
)
privateslot

update traffic statistics

Definition at line 1176 of file rpcconsole.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ autoCompleter

QCompleter* RPCConsole::autoCompleter = nullptr
private

Definition at line 169 of file rpcconsole.h.

◆ banTableContextMenu

QMenu* RPCConsole::banTableContextMenu = nullptr
private

Definition at line 167 of file rpcconsole.h.

◆ cachedNodeids

QList<NodeId> RPCConsole::cachedNodeids
private

Definition at line 163 of file rpcconsole.h.

◆ clientModel

ClientModel* RPCConsole::clientModel = nullptr
private

Definition at line 159 of file rpcconsole.h.

◆ cmdBeforeBrowsing

QString RPCConsole::cmdBeforeBrowsing
private

Definition at line 162 of file rpcconsole.h.

◆ consoleFontSize

int RPCConsole::consoleFontSize = 0
private

Definition at line 168 of file rpcconsole.h.

◆ history

QStringList RPCConsole::history
private

Definition at line 160 of file rpcconsole.h.

◆ historyPtr

int RPCConsole::historyPtr = 0
private

Definition at line 161 of file rpcconsole.h.

◆ m_last_wallet_model

WalletModel* RPCConsole::m_last_wallet_model {nullptr}
private

Definition at line 171 of file rpcconsole.h.

◆ m_node

interfaces::Node& RPCConsole::m_node
private

Definition at line 157 of file rpcconsole.h.

◆ peersTableContextMenu

QMenu* RPCConsole::peersTableContextMenu = nullptr
private

Definition at line 166 of file rpcconsole.h.

◆ platformStyle

const PlatformStyle* const RPCConsole::platformStyle
private

Definition at line 164 of file rpcconsole.h.

◆ rpcTimerInterface

RPCTimerInterface* RPCConsole::rpcTimerInterface = nullptr
private

Definition at line 165 of file rpcconsole.h.

◆ thread

QThread RPCConsole::thread
private

Definition at line 170 of file rpcconsole.h.

◆ ui

Ui::RPCConsole* const RPCConsole::ui
private

Definition at line 158 of file rpcconsole.h.


The documentation for this class was generated from the following files: