Define basic variables with const modifier
[novacoin.git] / src / main.h
index 862747b..e2661d9 100644 (file)
@@ -5,6 +5,8 @@
 #ifndef BITCOIN_MAIN_H
 #define BITCOIN_MAIN_H
 
+#include <algorithm>
+
 #include "timestamps.h"
 #include "bignum.h"
 #include "sync.h"
@@ -27,6 +29,17 @@ class CInv;
 class CRequestTracker;
 class CNode;
 
+//
+// Global state
+//
+static const unsigned int nStakeMinAge = 60 * 60 * 24 * 30; // 30 days as zero time weight
+static const unsigned int nStakeMaxAge = 60 * 60 * 24 * 90; // 90 days as full weight
+static const unsigned int nStakeTargetSpacing = 10 * 60; // 10-minute stakes spacing
+static const unsigned int nModifierInterval = 6 * 60 * 60; // time to elapse before new modifier is computed
+
+static const int nCoinbaseMaturity = 500;
+
+
 static const unsigned int MAX_BLOCK_SIZE = 1000000;
 static const unsigned int MAX_BLOCK_SIZE_GEN = MAX_BLOCK_SIZE/2;
 static const unsigned int MAX_BLOCK_SIGOPS = MAX_BLOCK_SIZE/50;
@@ -64,9 +77,7 @@ extern CCriticalSection cs_main;
 extern std::map<uint256, CBlockIndex*> mapBlockIndex;
 extern std::set<std::pair<COutPoint, unsigned int> > setStakeSeen;
 extern CBlockIndex* pindexGenesisBlock;
-extern unsigned int nStakeMinAge;
 extern unsigned int nNodeLifespan;
-extern int nCoinbaseMaturity;
 extern int nBestHeight;
 extern uint256 nBestChainTrust;
 extern uint256 nBestInvalidTrust;
@@ -613,7 +624,7 @@ public:
             filein >> *this;
         }
         catch (std::exception &e) {
-            return error("%s() : deserialize or I/O error", __PRETTY_FUNCTION__);
+            return error("%s() : deserialize or I/O error", BOOST_CURRENT_FUNCTION);
         }
 
         // Return file pointer
@@ -957,7 +968,8 @@ public:
         if (nTime >= ENTROPY_SWITCH_TIME || fTestNet)
         {
             // Take last bit of block hash as entropy bit
-            unsigned int nEntropyBit = ((GetHash().Get64()) & 1llu);
+            unsigned int nEntropyBit = ((GetHash().Get64()) & 1ULL);
+                       //unsigned int nEntropyBit = 1;
             if (fDebug && GetBoolArg("-printstakemodifier"))
                 printf("GetStakeEntropyBit: nTime=%u hashBlock=%s nEntropyBit=%u\n", nTime, GetHash().ToString().c_str(), nEntropyBit);
             return nEntropyBit;
@@ -1090,7 +1102,7 @@ public:
             filein >> *this;
         }
         catch (std::exception &e) {
-            return error("%s() : deserialize or I/O error", __PRETTY_FUNCTION__);
+            return error("%s() : deserialize or I/O error", BOOST_CURRENT_FUNCTION);
         }
 
         // Check the header