From e47052f6b5ea901ecdc1cb8245dd98a98b06618a Mon Sep 17 00:00:00 2001 From: Jonas Schnelli Date: Tue, 19 Jul 2016 15:50:50 +0200 Subject: [PATCH] [Qt] ClientModel add method to get the height of the header chain --- src/qt/clientmodel.cpp | 8 ++++++++ src/qt/clientmodel.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index 30f412dd23..e3240b95a2 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -68,6 +68,14 @@ int ClientModel::getNumBlocks() const return chainActive.Height(); } +int ClientModel::getHeaderHeight() const +{ + LOCK(cs_main); + if (!pindexBestHeader) + return 0; + return pindexBestHeader->nHeight; +} + quint64 ClientModel::getTotalBytesRecv() const { return CNode::GetTotalBytesRecv(); diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h index 99fd574b9e..f0c9a7988a 100644 --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -51,6 +51,7 @@ public: //! Return number of connections, default is in- and outbound (total) int getNumConnections(unsigned int flags = CONNECTIONS_ALL) const; int getNumBlocks() const; + int getHeaderHeight() const; //! Return number of transactions in the mempool long getMempoolSize() const;