Bitcoin Core  27.99.0
P2P Digital Currency
Signals | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
ClientModel Class Reference

Model for Bitcoin network client. More...

#include <clientmodel.h>

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

Signals

void numConnectionsChanged (int count)
 
void numBlocksChanged (int count, const QDateTime &blockDate, double nVerificationProgress, SyncType header, SynchronizationState sync_state)
 
void mempoolSizeChanged (long count, size_t mempoolSizeInBytes, size_t mempoolMaxSizeInBytes)
 
void networkActiveChanged (bool networkActive)
 
void alertsChanged (const QString &warnings)
 
void bytesChanged (quint64 totalBytesIn, quint64 totalBytesOut)
 
void message (const QString &title, const QString &message, unsigned int style)
 Fired when a message should be reported to the user. More...
 
void showProgress (const QString &title, int nProgress)
 

Public Member Functions

 ClientModel (interfaces::Node &node, OptionsModel *optionsModel, QObject *parent=nullptr)
 
 ~ClientModel ()
 
void stop ()
 
interfaces::Nodenode () const
 
OptionsModelgetOptionsModel ()
 
PeerTableModelgetPeerTableModel ()
 
PeerTableSortProxypeerTableSortProxy ()
 
BanTableModelgetBanTableModel ()
 
int getNumConnections (unsigned int flags=CONNECTIONS_ALL) const
 Return number of connections, default is in- and outbound (total) More...
 
int getNumBlocks () const
 
uint256 getBestBlockHash () EXCLUSIVE_LOCKS_REQUIRED(!m_cached_tip_mutex)
 
int getHeaderTipHeight () const
 
int64_t getHeaderTipTime () const
 
BlockSource getBlockSource () const
 Returns the block source of the current importing/syncing state. More...
 
QString getStatusBarWarnings () const
 Return warnings to be displayed in status bar. More...
 
QString formatFullVersion () const
 
QString formatSubVersion () const
 
bool isReleaseVersion () const
 
QString formatClientStartupTime () const
 
QString dataDir () const
 
QString blocksDir () const
 
bool getProxyInfo (std::string &ip_port) const
 
uint256 m_cached_tip_blocks GUARDED_BY (m_cached_tip_mutex)
 

Public Attributes

std::atomic< int > cachedBestHeaderHeight
 
std::atomic< int64_t > cachedBestHeaderTime
 
std::atomic< int > m_cached_num_blocks {-1}
 
Mutex m_cached_tip_mutex
 

Private Member Functions

void TipChanged (SynchronizationState sync_state, interfaces::BlockTip tip, double verification_progress, SyncType synctype) EXCLUSIVE_LOCKS_REQUIRED(!m_cached_tip_mutex)
 
void subscribeToCoreSignals ()
 
void unsubscribeFromCoreSignals ()
 

Private Attributes

interfaces::Nodem_node
 
std::vector< std::unique_ptr< interfaces::Handler > > m_event_handlers
 
OptionsModeloptionsModel
 
PeerTableModelpeerTableModel {nullptr}
 
PeerTableSortProxym_peer_table_sort_proxy {nullptr}
 
BanTableModelbanTableModel {nullptr}
 
QThread *const m_thread
 A thread to interact with m_node asynchronously. More...
 

Detailed Description

Model for Bitcoin network client.

Definition at line 53 of file clientmodel.h.

Constructor & Destructor Documentation

◆ ClientModel()

ClientModel::ClientModel ( interfaces::Node node,
OptionsModel optionsModel,
QObject *  parent = nullptr 
)
explicit

Definition at line 36 of file clientmodel.cpp.

Here is the call graph for this function:

◆ ~ClientModel()

ClientModel::~ClientModel ( )

Definition at line 79 of file clientmodel.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ alertsChanged

void ClientModel::alertsChanged ( const QString &  warnings)
signal
Here is the caller graph for this function:

◆ blocksDir()

QString ClientModel::blocksDir ( ) const

Definition at line 214 of file clientmodel.cpp.

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

◆ bytesChanged

void ClientModel::bytesChanged ( quint64  totalBytesIn,
quint64  totalBytesOut 
)
signal
Here is the caller graph for this function:

◆ dataDir()

QString ClientModel::dataDir ( ) const

Definition at line 209 of file clientmodel.cpp.

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

◆ formatClientStartupTime()

QString ClientModel::formatClientStartupTime ( ) const

Definition at line 204 of file clientmodel.cpp.

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

◆ formatFullVersion()

QString ClientModel::formatFullVersion ( ) const

Definition at line 189 of file clientmodel.cpp.

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

◆ formatSubVersion()

QString ClientModel::formatSubVersion ( ) const

Definition at line 194 of file clientmodel.cpp.

Here is the caller graph for this function:

◆ getBanTableModel()

BanTableModel * ClientModel::getBanTableModel ( )

Definition at line 184 of file clientmodel.cpp.

Here is the caller graph for this function:

◆ getBestBlockHash()

uint256 ClientModel::getBestBlockHash ( )

Definition at line 134 of file clientmodel.cpp.

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

◆ getBlockSource()

BlockSource ClientModel::getBlockSource ( ) const

Returns the block source of the current importing/syncing state.

Definition at line 157 of file clientmodel.cpp.

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

◆ getHeaderTipHeight()

int ClientModel::getHeaderTipHeight ( ) const

Definition at line 98 of file clientmodel.cpp.

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

◆ getHeaderTipTime()

int64_t ClientModel::getHeaderTipTime ( ) const

Definition at line 113 of file clientmodel.cpp.

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

◆ getNumBlocks()

int ClientModel::getNumBlocks ( ) const

Definition at line 126 of file clientmodel.cpp.

Here is the call graph for this function:

◆ getNumConnections()

int ClientModel::getNumConnections ( unsigned int  flags = CONNECTIONS_ALL) const

Return number of connections, default is in- and outbound (total)

Definition at line 84 of file clientmodel.cpp.

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

◆ getOptionsModel()

OptionsModel * ClientModel::getOptionsModel ( )

Definition at line 169 of file clientmodel.cpp.

Here is the caller graph for this function:

◆ getPeerTableModel()

PeerTableModel * ClientModel::getPeerTableModel ( )

Definition at line 174 of file clientmodel.cpp.

Here is the caller graph for this function:

◆ getProxyInfo()

bool ClientModel::getProxyInfo ( std::string &  ip_port) const

Definition at line 281 of file clientmodel.cpp.

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

◆ getStatusBarWarnings()

QString ClientModel::getStatusBarWarnings ( ) const

Return warnings to be displayed in status bar.

Definition at line 164 of file clientmodel.cpp.

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

◆ GUARDED_BY()

uint256 m_cached_tip_blocks ClientModel::GUARDED_BY ( m_cached_tip_mutex  )
inline

Definition at line 96 of file clientmodel.h.

◆ isReleaseVersion()

bool ClientModel::isReleaseVersion ( ) const

Definition at line 199 of file clientmodel.cpp.

◆ mempoolSizeChanged

void ClientModel::mempoolSizeChanged ( long  count,
size_t  mempoolSizeInBytes,
size_t  mempoolMaxSizeInBytes 
)
signal
Here is the caller graph for this function:

◆ message

void ClientModel::message ( const QString &  title,
const QString &  message,
unsigned int  style 
)
signal

Fired when a message should be reported to the user.

Here is the caller graph for this function:

◆ networkActiveChanged

void ClientModel::networkActiveChanged ( bool  networkActive)
signal
Here is the caller graph for this function:

◆ node()

interfaces::Node& ClientModel::node ( ) const
inline

Definition at line 63 of file clientmodel.h.

Here is the caller graph for this function:

◆ numBlocksChanged

void ClientModel::numBlocksChanged ( int  count,
const QDateTime &  blockDate,
double  nVerificationProgress,
SyncType  header,
SynchronizationState  sync_state 
)
signal
Here is the caller graph for this function:

◆ numConnectionsChanged

void ClientModel::numConnectionsChanged ( int  count)
signal
Here is the caller graph for this function:

◆ peerTableSortProxy()

PeerTableSortProxy * ClientModel::peerTableSortProxy ( )

Definition at line 179 of file clientmodel.cpp.

Here is the caller graph for this function:

◆ showProgress

void ClientModel::showProgress ( const QString &  title,
int  nProgress 
)
signal
Here is the caller graph for this function:

◆ stop()

void ClientModel::stop ( )

Definition at line 71 of file clientmodel.cpp.

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

◆ subscribeToCoreSignals()

void ClientModel::subscribeToCoreSignals ( )
private

Definition at line 242 of file clientmodel.cpp.

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

◆ TipChanged()

void ClientModel::TipChanged ( SynchronizationState  sync_state,
interfaces::BlockTip  tip,
double  verification_progress,
SyncType  synctype 
)
private

Definition at line 219 of file clientmodel.cpp.

◆ unsubscribeFromCoreSignals()

void ClientModel::unsubscribeFromCoreSignals ( )
private

Definition at line 276 of file clientmodel.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ banTableModel

BanTableModel* ClientModel::banTableModel {nullptr}
private

Definition at line 104 of file clientmodel.h.

◆ cachedBestHeaderHeight

std::atomic<int> ClientModel::cachedBestHeaderHeight
mutable

Definition at line 91 of file clientmodel.h.

◆ cachedBestHeaderTime

std::atomic<int64_t> ClientModel::cachedBestHeaderTime
mutable

Definition at line 92 of file clientmodel.h.

◆ m_cached_num_blocks

std::atomic<int> ClientModel::m_cached_num_blocks {-1}
mutable

Definition at line 93 of file clientmodel.h.

◆ m_cached_tip_mutex

Mutex ClientModel::m_cached_tip_mutex

Definition at line 95 of file clientmodel.h.

◆ m_event_handlers

std::vector<std::unique_ptr<interfaces::Handler> > ClientModel::m_event_handlers
private

Definition at line 100 of file clientmodel.h.

◆ m_node

interfaces::Node& ClientModel::m_node
private

Definition at line 99 of file clientmodel.h.

◆ m_peer_table_sort_proxy

PeerTableSortProxy* ClientModel::m_peer_table_sort_proxy {nullptr}
private

Definition at line 103 of file clientmodel.h.

◆ m_thread

QThread* const ClientModel::m_thread
private

A thread to interact with m_node asynchronously.

Definition at line 107 of file clientmodel.h.

◆ optionsModel

OptionsModel* ClientModel::optionsModel
private

Definition at line 101 of file clientmodel.h.

◆ peerTableModel

PeerTableModel* ClientModel::peerTableModel {nullptr}
private

Definition at line 102 of file clientmodel.h.


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