Calculate actual kernel and coin*day rates on the fly.
[novacoin.git] / src / kernel.cpp
index 19a391e..1f27060 100644 (file)
@@ -6,7 +6,9 @@
 
 #include "kernel.h"
 #include "txdb.h"
-#include "main.h"
+
+extern unsigned int nStakeMaxAge;
+extern unsigned int nStakeTargetSpacing;
 
 using namespace std;
 
@@ -389,7 +391,7 @@ bool CheckStakeKernelHash(unsigned int nBits, const CBlock& blockFrom, unsigned
 }
 
 // Scan given coins set for kernel solution
-bool ScanForStakeKernelHash(MetaMap &mapMeta, KernelSearchSettings &settings, CoinsSet::value_type &kernelcoin, unsigned int &nTimeTx, unsigned int &nBlockTime)
+bool ScanForStakeKernelHash(MetaMap &mapMeta, KernelSearchSettings &settings, CoinsSet::value_type &kernelcoin, unsigned int &nTimeTx, unsigned int &nBlockTime, uint64 &nKernelsTried, uint64 &nCoinDaysTried)
 {
     uint256 hashProofOfStake = 0;
 
@@ -440,6 +442,10 @@ bool ScanForStakeKernelHash(MetaMap &mapMeta, KernelSearchSettings &settings, Co
             // Calculate kernel hash
             hashProofOfStake = Hash(ss.begin(), ss.end());
 
+            // Update statistics
+            nKernelsTried += 1;
+            nCoinDaysTried += bnCoinDayWeight.getuint64();
+
             if (bnTargetProofOfStake >= CBigNum(hashProofOfStake))
             {
                 if (fDebug)