20#include <validation.h>
35 optionsModel(_optionsModel),
36 peerTableModel(nullptr),
37 banTableModel(nullptr),
38 m_thread(new QThread(this))
49 QTimer* timer =
new QTimer;
51 connect(timer, &QTimer::timeout, [
this] {
57 connect(
m_thread, &QThread::finished, timer, &QObject::deleteLater);
58 connect(
m_thread, &QThread::started, [timer] { timer->start(); });
62 QTimer::singleShot(0, timer, []() {
144 if (m_cached_tip_blocks.IsNull()) {
145 m_cached_tip_blocks = tip;
147 return m_cached_tip_blocks;
219 return QDateTime::fromSecsSinceEpoch(
GetStartupTime()).toString();
241 bool invoked = QMetaObject::invokeMethod(clientmodel,
"showProgress", Qt::QueuedConnection,
242 Q_ARG(QString, QString::fromStdString(title)),
243 Q_ARG(
int, nProgress));
250 bool invoked = QMetaObject::invokeMethod(clientmodel,
"updateNumConnections", Qt::QueuedConnection,
251 Q_ARG(
int, newNumConnections));
257 bool invoked = QMetaObject::invokeMethod(clientmodel,
"updateNetworkActive", Qt::QueuedConnection,
258 Q_ARG(
bool, networkActive));
264 qDebug() <<
"NotifyAlertChanged";
265 bool invoked = QMetaObject::invokeMethod(clientmodel,
"updateAlert", Qt::QueuedConnection);
271 qDebug() << QString(
"%1: Requesting update for peer banlist").arg(__func__);
272 bool invoked = QMetaObject::invokeMethod(clientmodel,
"updateBanlist", Qt::QueuedConnection);
295 bool invoked = QMetaObject::invokeMethod(clientmodel,
"numBlocksChanged", Qt::QueuedConnection,
297 Q_ARG(QDateTime, QDateTime::fromSecsSinceEpoch(tip.
block_time)),
298 Q_ARG(
double, verificationProgress),
299 Q_ARG(
bool, fHeader),
302 nLastUpdateNotification = now;
#define CLIENT_VERSION_IS_RELEASE
const fs::path & GetBlocksDirPath() const
Get blocks directory path.
const fs::path & GetDataDirNet() const
Get data directory path with appended network identifier.
Qt model providing information about connected peers, similar to the "getpeerinfo" RPC call.
std::string ToStringIPPort() const
Model for Bitcoin network client.
std::unique_ptr< interfaces::Handler > m_handler_banned_list_changed
void bytesChanged(quint64 totalBytesIn, quint64 totalBytesOut)
QString blocksDir() const
QString getStatusBarWarnings() const
Return warnings to be displayed in status bar.
uint256 getBestBlockHash()
int getHeaderTipHeight() const
std::unique_ptr< interfaces::Handler > m_handler_show_progress
std::atomic< int64_t > cachedBestHeaderTime
std::unique_ptr< interfaces::Handler > m_handler_notify_alert_changed
interfaces::Node & m_node
PeerTableModel * getPeerTableModel()
void updateNetworkActive(bool networkActive)
PeerTableSortProxy * peerTableSortProxy()
std::atomic< int > cachedBestHeaderHeight
void updateNumConnections(int numConnections)
void numConnectionsChanged(int count)
int64_t getHeaderTipTime() const
std::unique_ptr< interfaces::Handler > m_handler_notify_block_tip
QString formatClientStartupTime() const
int getNumConnections(unsigned int flags=CONNECTIONS_ALL) const
Return number of connections, default is in- and outbound (total)
enum BlockSource getBlockSource() const
Returns enum BlockSource of the current importing/syncing state.
ClientModel(interfaces::Node &node, OptionsModel *optionsModel, QObject *parent=nullptr)
std::unique_ptr< interfaces::Handler > m_handler_notify_num_connections_changed
std::unique_ptr< interfaces::Handler > m_handler_notify_network_active_changed
OptionsModel * optionsModel
BanTableModel * banTableModel
QThread *const m_thread
A thread to interact with m_node asynchronously.
std::unique_ptr< interfaces::Handler > m_handler_notify_header_tip
BanTableModel * getBanTableModel()
void unsubscribeFromCoreSignals()
void alertsChanged(const QString &warnings)
std::atomic< int > m_cached_num_blocks
OptionsModel * getOptionsModel()
QString formatFullVersion() const
PeerTableModel * peerTableModel
PeerTableSortProxy * m_peer_table_sort_proxy
bool getProxyInfo(std::string &ip_port) const
QString formatSubVersion() const
void mempoolSizeChanged(long count, size_t mempoolSizeInBytes)
bool isReleaseVersion() const
void subscribeToCoreSignals()
void networkActiveChanged(bool networkActive)
Interface from Qt to configuration data structure for Bitcoin client.
Qt model providing information about connected peers, similar to the "getpeerinfo" RPC call.
Top-level interface for a bitcoin node (bitcoind process).
virtual bool getImporting()=0
Get importing.
virtual std::unique_ptr< Handler > handleShowProgress(ShowProgressFn fn)=0
virtual bilingual_str getWarnings()=0
Get warnings.
virtual std::unique_ptr< Handler > handleNotifyBlockTip(NotifyBlockTipFn fn)=0
virtual std::unique_ptr< Handler > handleNotifyAlertChanged(NotifyAlertChangedFn fn)=0
virtual std::unique_ptr< Handler > handleNotifyHeaderTip(NotifyHeaderTipFn fn)=0
virtual bool getProxy(Network net, proxyType &proxy_info)=0
Get proxy.
virtual bool getReindex()=0
Get reindex.
virtual size_t getMempoolSize()=0
Get mempool size.
virtual size_t getNodeCount(ConnectionDirection flags)=0
Get number of connections.
virtual bool getHeaderTip(int &height, int64_t &block_time)=0
Get header tip height and time.
virtual uint256 getBestBlockHash()=0
Get best block hash.
virtual int64_t getTotalBytesRecv()=0
Get total bytes recv.
virtual std::unique_ptr< Handler > handleBannedListChanged(BannedListChangedFn fn)=0
virtual std::unique_ptr< Handler > handleNotifyNetworkActiveChanged(NotifyNetworkActiveChangedFn fn)=0
virtual int64_t getTotalBytesSent()=0
Get total bytes sent.
virtual size_t getMempoolDynamicUsage()=0
Get mempool dynamic usage.
virtual int getNumBlocks()=0
Get num blocks.
virtual std::unique_ptr< Handler > handleNotifyNumConnectionsChanged(NotifyNumConnectionsChangedFn fn)=0
static int64_t nLastHeaderTipUpdateNotification
static void NotifyAlertChanged(ClientModel *clientmodel)
static void ShowProgress(ClientModel *clientmodel, const std::string &title, int nProgress)
static void BlockTipChanged(ClientModel *clientmodel, SynchronizationState sync_state, interfaces::BlockTip tip, double verificationProgress, bool fHeader)
static void NotifyNetworkActiveChanged(ClientModel *clientmodel, bool networkActive)
static void NotifyNumConnectionsChanged(ClientModel *clientmodel, int newNumConnections)
static int64_t nLastBlockTipUpdateNotification
static void BannedListChanged(ClientModel *clientmodel)
std::string FormatFullVersion()
static const int MODEL_UPDATE_DELAY
QString boostPathToQString(const fs::path &path)
Convert OS specific boost path to QString through UTF-8.
void ThreadRename(std::string &&)
Rename a thread both in terms of an internal (in-memory) name as well as its system thread name.
std::string strSubVersion
Subversion as sent to the P2P network in version messages.
Block tip (could be a header or not, depends on the subscribed signal).
#define WITH_LOCK(cs, code)
Run code while locking a mutex.
int64_t GetTimeMillis()
Returns the system time (not mockable)
SynchronizationState
Current sync state passed to tip changed callbacks.