Stake miner status icon
[novacoin.git] / src / qt / clientmodel.cpp
index b820d16..064882b 100644 (file)
@@ -11,6 +11,9 @@
 #include <QDateTime>
 #include <QTimer>
 
+extern double GetPoSKernelPS();
+extern double GetDifficulty(const CBlockIndex* blockindex);
+
 static const int64 nClientStartupTime = GetTime();
 
 ClientModel::ClientModel(OptionsModel *optionsModel, QObject *parent) :
@@ -32,6 +35,19 @@ ClientModel::~ClientModel()
     unsubscribeFromCoreSignals();
 }
 
+double ClientModel::getPoSKernelPS()
+{
+    return GetPoSKernelPS();
+}
+
+double ClientModel::getDifficulty(bool fProofofStake)
+{
+    if (fProofofStake)
+       return GetDifficulty(GetLastBlockIndex(pindexBest,true));
+    else
+       return GetDifficulty(GetLastBlockIndex(pindexBest,false));
+}
+
 int ClientModel::getNumConnections() const
 {
     return vNodes.size();
@@ -50,7 +66,10 @@ int ClientModel::getNumBlocksAtStartup()
 
 QDateTime ClientModel::getLastBlockDate() const
 {
-    return QDateTime::fromTime_t(pindexBest->GetBlockTime());
+    if (pindexBest)
+        return QDateTime::fromTime_t(pindexBest->GetBlockTime());
+    else
+        return QDateTime::fromTime_t(1360105017); // Genesis block's time
 }
 
 void ClientModel::updateTimer()