5#include <bitcoin-build-config.h>
24#include <validation.h>
51 QTimer* timer =
new QTimer;
53 connect(timer, &QTimer::timeout, [
this] {
59 connect(
m_thread, &QThread::finished, timer, &QObject::deleteLater);
60 connect(
m_thread, &QThread::started, [timer] { timer->start(); });
64 QTimer::singleShot(0, timer, []() {
95 return m_node.getNodeCount(connections);
105 if (
m_node.getHeaderTip(height, blockTime)) {
118 if (
m_node.getHeaderTip(height, blockTime)) {
129 return m_node.getNetLocalAddresses();
152 tip =
m_node.getBestBlockHash();
158 if (m_cached_tip_blocks.IsNull()) {
159 m_cached_tip_blocks = tip;
161 return m_cached_tip_blocks;
173 return QString::fromStdString(
m_node.getWarnings().translated);
208 return CLIENT_VERSION_IS_RELEASE;
239 const auto now{throttle ? SteadyClock::now() : SteadyClock::time_point{}};
246 nLastUpdateNotification = now;
252 [
this](
const std::string& title,
int progress, [[maybe_unused]]
bool resume_possible) {
253 Q_EMIT showProgress(QString::fromStdString(title), progress);
256 [
this](
int new_num_connections) {
257 Q_EMIT numConnectionsChanged(new_num_connections);
260 [
this](
bool network_active) {
261 Q_EMIT networkActiveChanged(network_active);
265 qDebug() <<
"ClientModel: NotifyAlertChanged";
266 Q_EMIT alertsChanged(getStatusBarWarnings());
270 qDebug() <<
"ClienModel: Requesting update for peer banlist";
271 QMetaObject::invokeMethod(banTableModel, [this] { banTableModel->refresh(); });
273 m_event_handlers.emplace_back(m_node.handleNotifyBlockTip(
275 TipChanged(sync_state, tip, verification_progress, SyncType::BLOCK_SYNC);
277 m_event_handlers.emplace_back(m_node.handleNotifyHeaderTip(
279 TipChanged(sync_state, tip, 0.0, presync ? SyncType::HEADER_PRESYNC : SyncType::HEADER_SYNC);
Qt model providing information about banned peers, similar to the "getpeerinfo" RPC call.
std::string ToStringAddrPort() const
void bytesChanged(quint64 totalBytesIn, quint64 totalBytesOut)
QString blocksDir() const
QString getStatusBarWarnings() const
Return warnings to be displayed in status bar.
std::vector< std::unique_ptr< interfaces::Handler > > m_event_handlers
std::map< CNetAddr, LocalServiceInfo > getNetLocalAddresses() const
int getHeaderTipHeight() const
std::atomic< int64_t > cachedBestHeaderTime
interfaces::Node & m_node
PeerTableModel * getPeerTableModel()
PeerTableSortProxy * peerTableSortProxy()
std::atomic< int > cachedBestHeaderHeight
uint256 getBestBlockHash() EXCLUSIVE_LOCKS_REQUIRED(!m_cached_tip_mutex)
BlockSource getBlockSource() const
Returns the block source of the current importing/syncing state.
int64_t getHeaderTipTime() const
QString formatClientStartupTime() const
int getNumConnections(unsigned int flags=CONNECTIONS_ALL) const
Return number of connections, default is in- and outbound (total).
ClientModel(interfaces::Node &node, OptionsModel *optionsModel, QObject *parent=nullptr)
OptionsModel * optionsModel
BanTableModel * banTableModel
QThread *const m_thread
A thread to interact with m_node asynchronously.
BanTableModel * getBanTableModel()
void unsubscribeFromCoreSignals()
void numBlocksChanged(int count, const QDateTime &blockDate, double nVerificationProgress, SyncType header, SynchronizationState sync_state)
void TipChanged(SynchronizationState sync_state, interfaces::BlockTip tip, double verification_progress, SyncType synctype) EXCLUSIVE_LOCKS_REQUIRED(!m_cached_tip_mutex)
void mempoolSizeChanged(long count, size_t mempoolSizeInBytes, size_t mempoolMaxSizeInBytes)
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
bool isReleaseVersion() const
void subscribeToCoreSignals()
Interface from Qt to configuration data structure for Bitcoin client.
Qt model providing information about connected peers, similar to the "getpeerinfo" RPC call.
constexpr bool IsNull() const
Top-level interface for a bitcoin node (bitcoind process).
static SteadyClock::time_point g_last_block_tip_update_notification
static SteadyClock::time_point g_last_header_tip_update_notification
std::string FormatFullVersion()
SteadyClock::duration GetUptime()
Monotonic uptime (not affected by system time changes).
static constexpr auto MODEL_UPDATE_DELAY
QString PathToQString(const fs::path &path)
Convert OS specific boost path to QString through UTF-8.
void ThreadRename(const std::string &)
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)
constexpr int64_t TicksSeconds(Duration d)
SynchronizationState
Current sync state passed to tip changed callbacks.