обновление значений в стоблце "Вес"
authorfsb4000 <fsb4000@yandex.ru>
Wed, 26 Nov 2014 09:26:00 +0000 (15:26 +0600)
committerfsb4000 <fsb4000@yandex.ru>
Wed, 26 Nov 2014 09:26:00 +0000 (15:26 +0600)
src/kernelrecord.cpp
src/kernelrecord.h
src/qt/mintingtablemodel.cpp

index f4ec68e..ef46b46 100644 (file)
@@ -2,9 +2,7 @@
 
 #include "wallet.h"
 #include "base58.h"
-#include "main.h"
 
-#include <math.h>
 
 using namespace std;
 
@@ -77,6 +75,16 @@ int64 KernelRecord::getAge() const
     return (GetAdjustedTime() - nTime) / 86400;
 }
 
+uint64 KernelRecord::getCoinDay() const
+{
+    int64 nWeight = GetAdjustedTime() - nTime - nStakeMinAge;
+    if( nWeight <  0)
+        return 0;
+    nWeight = min(nWeight, (int64)nStakeMaxAge);
+    uint64 coinAge = (nValue * nWeight ) / (COIN * 86400);
+    return coinAge;
+}
+
 int64 KernelRecord::getPoSReward(int nBits, int minutes)
 {
     double PoSReward;
index c18c6cf..fce7b24 100644 (file)
@@ -41,6 +41,7 @@ public:
 
     std::string getTxID();
     int64 getAge() const;
+    uint64 getCoinDay() const;
     double getProbToMintStake(double difficulty, int timeOffset = 0) const;
     double getProbToMintWithinNMinutes(double difficulty, int minutes);
     int64 getPoSReward(int nBits, int timeOffset);
index 97e3245..b77a4c8 100644 (file)
@@ -401,7 +401,7 @@ QString MintingTableModel::formatTxHash(const KernelRecord *wtx) const
 
 QString MintingTableModel::formatTxCoinDay(const KernelRecord *wtx) const
 {
-    return QString::number(wtx->coinAge);
+    return QString::number(wtx->getCoinDay());
 }
 
 QString MintingTableModel::formatTxAge(const KernelRecord *wtx) const