24 #include "validation.h"
32 static const int64_t nClientStartupTime =
GetTime();
34 static int64_t nLastBlockTipUpdateNotification = 0;
37 optionsModel(optionsModel),
41 cachedMasternodeCountString(
""),
42 cachedReindexing(0), cachedImporting(0),
43 numBlocksAtStartup(-1), pollTimer(0)
75 return g_connman->GetNodeCount(connections);
82 int unknown = std::max(0, info.total - info.ipv4 - info.ipv6 - info.onion);
84 return tr(
"Total: %1 (IPv4: %2 / IPv6: %3 / Tor: %4 / Unknown: %5)").arg(QString::number(info.total))
85 .arg(QString::number(info.ipv4))
86 .arg(QString::number(info.ipv6))
87 .arg(QString::number(info.onion))
88 .arg(QString::number(unknown));
134 return QDateTime::fromTime_t(nTime);
140 return QString::fromStdString(nHash.
GetHex());
253 return QString::fromStdString(
GetWarnings(
"statusbar"));
288 return QDateTime::fromTime_t(nClientStartupTime).toString();
311 if (!initialSync || now - nLastBlockTipUpdateNotification > MODEL_UPDATE_DELAY) {
318 nLastBlockTipUpdateNotification = now;
323 static void ShowProgress(
ClientModel* clientmodel,
const std::string& title,
int nProgress)
326 QMetaObject::invokeMethod(clientmodel,
"showProgress", Qt::QueuedConnection,
327 Q_ARG(QString, QString::fromStdString(title)),
328 Q_ARG(
int, nProgress));
331 static void NotifyNumConnectionsChanged(
ClientModel* clientmodel,
int newNumConnections)
334 QMetaObject::invokeMethod(clientmodel,
"updateNumConnections", Qt::QueuedConnection,
335 Q_ARG(
int, newNumConnections));
338 static void NotifyNetworkActiveChanged(
ClientModel *clientmodel,
bool networkActive)
340 QMetaObject::invokeMethod(clientmodel,
"updateNetworkActive", Qt::QueuedConnection,
341 Q_ARG(
bool, networkActive));
344 static void NotifyAlertChanged(
ClientModel* clientmodel)
346 qDebug() <<
"NotifyAlertChanged";
347 QMetaObject::invokeMethod(clientmodel,
"updateAlert", Qt::QueuedConnection);
350 static void BannedListChanged(
ClientModel *clientmodel)
352 qDebug() << QString(
"%1: Requesting update for peer banlist").arg(__func__);
353 QMetaObject::invokeMethod(clientmodel,
"updateBanlist", Qt::QueuedConnection);
388 for (
const std::pair<const CNetAddr, LocalServiceInfo>& item :
mapLocalHost) {
389 if (item.first.IsTor()) {
const CChainParams & Params()
Return the currently selected parameters.
Qt model providing information about connected peers, similar to the "getpeerinfo" RPC call.
The block chain is a tree shaped structure starting with the genesis block at the root,...
uint256 GetBlockHash() const
int64_t GetBlockTime() const
int nHeight
height of the entry in the chain. The genesis block has height 0
CBlockIndex * Tip(bool fProofOfStake=false) const
Returns the index entry for the tip of this chain, or nullptr if none.
const CBlock & GenesisBlock() const
boost::signals2::signal< void(const std::string &title, int nProgress)> ShowProgress
Show progress e.g.
boost::signals2::signal< void(int newNumConnections)> NotifyNumConnectionsChanged
Number of network connections changed.
boost::signals2::signal< void()> NotifyAlertChanged
New, updated or cancelled alert.
boost::signals2::signal< void(void)> BannedListChanged
Banlist did change.
boost::signals2::signal< void(bool fInitialDownload, const CBlockIndex *newTip)> NotifyBlockTip
New block has been accepted.
boost::signals2::signal< void(bool networkActive)> NotifyNetworkActiveChanged
Network activity state changed.
CMasternodeMan::MNsInfo getMNsInfo() const
A combination of a network address (CNetAddr) and a (TCP) port.
std::string ToStringIPPort() const
Model for PIVX network client.
std::unique_ptr< interfaces::Handler > m_handler_banned_list_changed
void bytesChanged(quint64 totalBytesIn, quint64 totalBytesOut)
QString getLastBlockHash() const
void setNetworkActive(bool active)
Toggle network activity state in core.
QString cachedMasternodeCountString
QString getStatusBarWarnings() const
Return warnings to be displayed in status bar.
void setCacheReindexing(bool reindex)
bool getTorInfo(std::string &ip_port) const
std::unique_ptr< interfaces::Handler > m_handler_show_progress
QString clientName() const
int64_t getLastBlockProcessedTime() const
void setCacheTip(const CBlockIndex *const tip)
uint256 getLastBlockProcessed() const
quint64 getTotalBytesRecv() const
std::unique_ptr< interfaces::Handler > m_handler_notify_alert_changed
quint64 getTotalBytesSent() const
void startMasternodesTimer()
PeerTableModel * getPeerTableModel()
void numBlocksChanged(int count)
void updateNetworkActive(bool networkActive)
int getNumBlocksAtStartup()
double getVerificationProgress() const
void setCacheImporting(bool import)
void updateNumConnections(int numConnections)
void stopMasternodesTimer()
QDateTime getLastBlockDate() const
void strMasternodesChanged(const QString &strMasternodes)
void numConnectionsChanged(int count)
QString getMasternodeCountString()
std::unique_ptr< interfaces::Handler > m_handler_notify_block_tip
bool getNetworkActive() const
Return true if network activity in core is enabled.
QString formatClientStartupTime() const
QString getMasternodesCountString()
int getNumConnections(unsigned int flags=CONNECTIONS_ALL) const
Return number of connections, default is in- and outbound (total)
enum BlockSource getBlockSource() const
Return true if core is importing blocks.
static void mapPort(bool use_upnp, bool use_natpmp)
Set the automatic port mapping options.
void setCacheInitialSync(bool _initialSync)
std::atomic< bool > cachedInitialSync
std::unique_ptr< interfaces::Handler > m_handler_notify_num_connections_changed
OptionsModel * optionsModel
BanTableModel * banTableModel
BanTableModel * getBanTableModel()
void unsubscribeFromCoreSignals()
std::unique_ptr< interfaces::Handler > m_handler_notify_net_activity_changed
void alertsChanged(const QString &warnings)
OptionsModel * getOptionsModel()
QString formatFullVersion() const
std::atomic_int m_cached_masternodes_count
PeerTableModel * peerTableModel
int getLastBlockProcessedHeight() const
ClientModel(OptionsModel *optionsModel, QObject *parent=0)
const CBlockIndex * cacheTip
bool isReleaseVersion() const
bool inInitialBlockDownload() const
Return true if core is doing initial block download.
void subscribeToCoreSignals()
void networkActiveChanged(bool networkActive)
Interface from Qt to configuration data structure for PIVX client.
Qt model providing information about connected peers, similar to the "getpeerinfo" RPC call.
std::string GetHex() const
std::string FormatFullVersion()
const std::string CLIENT_NAME
CClientUIInterface uiInterface
std::unique_ptr< CConnman > g_connman
void StartMapPort(bool use_upnp, bool use_natpmp)
CMasternodeMan mnodeman
Masternode manager.
double GuessVerificationProgress(const CBlockIndex *pindex, bool fSigchecks)
Guess how far we are in the verification process at the given block index.
QString boostPathToQString(const fs::path &path)
std::unique_ptr< Handler > MakeHandler(boost::signals2::connection connection)
Return handler wrapping a boost signal connection.
std::map< CNetAddr, LocalServiceInfo > mapLocalHost
RecursiveMutex cs_mapLocalHost
bool IsReachable(enum Network net)
RecursiveMutex cs_main
Global state.
bool GetProxy(enum Network net, proxyType &proxyInfoOut)
CService LookupNumeric(const std::string &name, int portDefault)
#define CLIENT_VERSION_IS_RELEASE
#define WITH_LOCK(cs, code)
Run code while locking a mutex.
const fs::path & GetDataDir(bool fNetSpecific)
int64_t GetTimeMillis()
Returns the system time (not mockable)
int64_t GetTime()
DEPRECATED Use either GetSystemTimeInSeconds (not mockable) or GetTime<T> (mockable)
std::atomic< bool > fImporting
std::atomic< bool > fReindex
CChain chainActive
The currently-connected chain of blocks (protected by cs_main).
std::string GetWarnings(const std::string &strFor)