обновление статистики более часто 69/head
authorfsb4000 <fsb4000@yandex.ru>
Sat, 29 Nov 2014 13:41:27 +0000 (19:41 +0600)
committerfsb4000 <fsb4000@yandex.ru>
Sat, 29 Nov 2014 13:41:27 +0000 (19:41 +0600)
src/qt/bitcoingui.cpp
src/wallet.cpp

index 2f9e075..c15c567 100644 (file)
@@ -420,7 +420,10 @@ void BitcoinGUI::setClientModel(ClientModel *clientModel)
 
         setNumBlocks(clientModel->getNumBlocks(), clientModel->getNumBlocksOfPeers());
         connect(clientModel, SIGNAL(numBlocksChanged(int,int)), this, SLOT(setNumBlocks(int,int)));
-        connect(clientModel, SIGNAL(numBlocksChanged(int,int)), this, SLOT(updateMining()));
+
+        QTimer *timer = new QTimer(this);
+        connect(timer, SIGNAL(timeout()), this, SLOT(updateMining()));
+        timer->start(10*1000); //10 seconds
 
         // Report errors from network/worker thread
         connect(clientModel, SIGNAL(error(QString,QString,bool)), this, SLOT(error(QString,QString,bool)));
index d12e28f..f9ce658 100644 (file)
@@ -1630,8 +1630,7 @@ void CWallet::GetStakeStats(float &nKernelsRate, float &nCoinDaysRate)
 {
     static uint64 nLastKernels = 0, nLastCoinDays = 0;
     static float nLastKernelsRate = 0, nLastCoinDaysRate = 0;
-    static unsigned int nLastTime = GetTime();
-
+    static int64 nLastTime = GetTime();
 
     if (nKernelsTried < nLastKernels)
     {
@@ -1641,8 +1640,9 @@ void CWallet::GetStakeStats(float &nKernelsRate, float &nCoinDaysRate)
         nLastTime = GetTime();
     }
 
-    unsigned int nInterval = GetTime() - nLastTime;
-    if (nKernelsTried > 1000 && nInterval > 5)
+    int64 nInterval = GetTime() - nLastTime;
+    //if (nKernelsTried > 1000 && nInterval > 5)
+    if (nInterval > 10)
     {
         nKernelsRate = nLastKernelsRate = ( nKernelsTried - nLastKernels ) / (float) nInterval;
         nCoinDaysRate = nLastCoinDaysRate = ( nCoinDaysTried - nLastCoinDays ) / (float) nInterval;