19 #include <validation.h> 33 optionsModel(_optionsModel),
34 peerTableModel(nullptr),
35 banTableModel(nullptr),
36 m_thread(new QThread(this))
43 QTimer* timer =
new QTimer;
45 connect(timer, &QTimer::timeout, [
this] {
51 connect(
m_thread, &QThread::finished, timer, &QObject::deleteLater);
52 connect(
m_thread, &QThread::started, [timer] { timer->start(); });
56 QTimer::singleShot(0, timer, []() {
138 if (m_cached_tip_blocks.IsNull()) {
139 m_cached_tip_blocks = tip;
141 return m_cached_tip_blocks;
230 bool invoked = QMetaObject::invokeMethod(clientmodel,
"showProgress", Qt::QueuedConnection,
231 Q_ARG(QString, QString::fromStdString(title)),
232 Q_ARG(
int, nProgress));
239 bool invoked = QMetaObject::invokeMethod(clientmodel,
"updateNumConnections", Qt::QueuedConnection,
240 Q_ARG(
int, newNumConnections));
246 bool invoked = QMetaObject::invokeMethod(clientmodel,
"updateNetworkActive", Qt::QueuedConnection,
247 Q_ARG(
bool, networkActive));
253 qDebug() <<
"NotifyAlertChanged";
254 bool invoked = QMetaObject::invokeMethod(clientmodel,
"updateAlert", Qt::QueuedConnection);
260 qDebug() << QString(
"%1: Requesting update for peer banlist").arg(__func__);
261 bool invoked = QMetaObject::invokeMethod(clientmodel,
"updateBanlist", Qt::QueuedConnection);
284 bool invoked = QMetaObject::invokeMethod(clientmodel,
"numBlocksChanged", Qt::QueuedConnection,
286 Q_ARG(QDateTime, QDateTime::fromTime_t(tip.
block_time)),
287 Q_ARG(
double, verificationProgress),
288 Q_ARG(
bool, fHeader),
291 nLastUpdateNotification =
now;
virtual std::unique_ptr< Handler > handleNotifyHeaderTip(NotifyHeaderTipFn fn)=0
QString formatClientStartupTime() const
PeerTableModel * peerTableModel
void updateNetworkActive(bool networkActive)
QString formatSubVersion() const
static void NotifyAlertChanged(ClientModel *clientmodel)
Block tip (could be a header or not, depends on the subscribed signal).
interfaces::Node & m_node
const std::chrono::seconds now
SynchronizationState
Current sync state passed to tip changed callbacks.
bool isReleaseVersion() const
std::atomic< int64_t > cachedBestHeaderTime
int64_t GetTimeMillis()
Returns the system time (not mockable)
QString blocksDir() const
virtual size_t getMempoolDynamicUsage()=0
Get mempool dynamic usage.
virtual bool getProxy(Network net, proxyType &proxy_info)=0
Get proxy.
QThread *const m_thread
A thread to interact with m_node asynchronously.
virtual int64_t getTotalBytesRecv()=0
Get total bytes recv.
virtual bool getImporting()=0
Get importing.
virtual size_t getMempoolSize()=0
Get mempool size.
static void ShowProgress(ClientModel *clientmodel, const std::string &title, int nProgress)
void ThreadRename(std::string &&)
Rename a thread both in terms of an internal (in-memory) name as well as its system thread name...
void networkActiveChanged(bool networkActive)
BanTableModel * banTableModel
ClientModel(interfaces::Node &node, OptionsModel *optionsModel, QObject *parent=nullptr)
std::unique_ptr< interfaces::Handler > m_handler_show_progress
OptionsModel * getOptionsModel()
const fs::path & GetBlocksDir()
std::atomic< int > cachedBestHeaderHeight
PeerTableModel * getPeerTableModel()
virtual std::unique_ptr< Handler > handleNotifyBlockTip(NotifyBlockTipFn fn)=0
void numConnectionsChanged(int count)
QString getStatusBarWarnings() const
Return warnings to be displayed in status bar.
void alertsChanged(const QString &warnings)
std::unique_ptr< interfaces::Handler > m_handler_notify_block_tip
virtual std::unique_ptr< Handler > handleNotifyNumConnectionsChanged(NotifyNumConnectionsChangedFn fn)=0
void bytesChanged(quint64 totalBytesIn, quint64 totalBytesOut)
#define CLIENT_VERSION_IS_RELEASE
static int64_t nLastHeaderTipUpdateNotification
std::atomic< int > m_cached_num_blocks
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.
Qt model providing information about connected peers, similar to the "getpeerinfo" RPC call...
virtual bilingual_str getWarnings()=0
Get warnings.
const fs::path & GetDataDir(bool fNetSpecific)
void unsubscribeFromCoreSignals()
virtual std::unique_ptr< Handler > handleShowProgress(ShowProgressFn fn)=0
BanTableModel * getBanTableModel()
void subscribeToCoreSignals()
std::unique_ptr< interfaces::Handler > m_handler_banned_list_changed
virtual std::unique_ptr< Handler > handleBannedListChanged(BannedListChangedFn fn)=0
std::string strSubVersion
Subversion as sent to the P2P network in version messages.
Model for Bitcoin network client.
std::unique_ptr< interfaces::Handler > m_handler_notify_header_tip
#define WITH_LOCK(cs, code)
Run code while locking a mutex.
std::string FormatFullVersion()
static const int MODEL_UPDATE_DELAY
static void BannedListChanged(ClientModel *clientmodel)
virtual bool getReindex()=0
Get reindex.
std::unique_ptr< interfaces::Handler > m_handler_notify_num_connections_changed
virtual uint256 getBestBlockHash()=0
Get best block hash.
Interface from Qt to configuration data structure for Bitcoin client.
static int64_t nLastBlockTipUpdateNotification
Qt model providing information about connected peers, similar to the "getpeerinfo" RPC call...
std::string ToStringIPPort() const
virtual bool getHeaderTip(int &height, int64_t &block_time)=0
Get header tip height and time.
static void NotifyNetworkActiveChanged(ClientModel *clientmodel, bool networkActive)
OptionsModel * optionsModel
static void BlockTipChanged(ClientModel *clientmodel, SynchronizationState sync_state, interfaces::BlockTip tip, double verificationProgress, bool fHeader)
void mempoolSizeChanged(long count, size_t mempoolSizeInBytes)
uint256 getBestBlockHash()
virtual int getNumBlocks()=0
Get num blocks.
virtual std::unique_ptr< Handler > handleNotifyAlertChanged(NotifyAlertChangedFn fn)=0
std::unique_ptr< interfaces::Handler > m_handler_notify_network_active_changed
void updateNumConnections(int numConnections)
int getHeaderTipHeight() const
QString boostPathToQString(const fs::path &path)
Convert OS specific boost path to QString through UTF-8.
std::unique_ptr< interfaces::Handler > m_handler_notify_alert_changed
virtual std::unique_ptr< Handler > handleNotifyNetworkActiveChanged(NotifyNetworkActiveChangedFn fn)=0
static void NotifyNumConnectionsChanged(ClientModel *clientmodel, int newNumConnections)
virtual int64_t getTotalBytesSent()=0
Get total bytes sent.
int64_t getHeaderTipTime() const
Top-level interface for a bitcoin node (bitcoind process).
virtual size_t getNodeCount(CConnman::NumConnections flags)=0
Get number of connections.
QString formatFullVersion() const
bool getProxyInfo(std::string &ip_port) const