nBlockTrust cleanup.
authorCryptoManiac <balthazar.ad@gmail.com>
Wed, 16 Sep 2015 12:51:18 +0000 (15:51 +0300)
committerCryptoManiac <balthazar.ad@gmail.com>
Wed, 16 Sep 2015 12:51:18 +0000 (15:51 +0300)
Novacoin/DatabaseObjects.cs
Novacoin/NetInfo.cs

index 57a47bd..b12d681 100644 (file)
@@ -405,26 +405,14 @@ namespace Novacoin
         {
             get
             {
-                uint256 nTarget = 0;
-                nTarget.Compact = nBits;
-
-                /* Old protocol */
-                if (nTime < NetInfo.nChainChecksSwitchTime)
+                // Return 1 for the first 12 blocks
+                if (prev == null || prev.nHeight < 12)
                 {
-                    return IsProofOfStake ? (new uint256(1) << 256) / (nTarget + 1) : 1;
+                    return 1;
                 }
 
-                /* New protocol */
-
-                // Calculate work amount for block
-                var nPoWTrust = NetInfo.nPoWBase / (nTarget + 1);
-
-                // Set nPowTrust to 1 if we are checking PoS block or PoW difficulty is too low
-                nPoWTrust = (IsProofOfStake || !nPoWTrust) ? 1 : nPoWTrust;
-
-                // Return nPoWTrust for the first 12 blocks
-                if (prev == null || prev.nHeight < 12)
-                    return nPoWTrust;
+                uint256 nTarget = 0;
+                nTarget.Compact = nBits;
 
                 CBlockStoreItem currentIndex = prev;
 
@@ -460,6 +448,12 @@ namespace Novacoin
                 }
                 else
                 {
+                    // Calculate work amount for block
+                    var nPoWTrust = NetInfo.nPoWBase / (nTarget + 1);
+
+                    // Set nPowTrust to 1 if we are checking PoS block or PoW difficulty is too low
+                    nPoWTrust = (IsProofOfStake || !nPoWTrust) ? 1 : nPoWTrust;
+
                     var nLastBlockTrust = prev.nChainTrust - prev.prev.nChainTrust;
 
                     // Return nPoWTrust + 2/3 of previous block score if two parent blocks are not PoS blocks
index 97d83e8..ef74166 100644 (file)
         public static uint256 nPoWBase = new uint256("00000000ffff0000000000000000000000000000000000000000000000000000");
 
         /// <summary>
-        /// Fri, 20 Sep 2013 00:00:00 GMT
-        /// </summary>
-        public const uint nChainChecksSwitchTime = 1379635200;
-
-        /// <summary>
         /// Sat, 20 Jul 2013 00:00:00 GMT
         /// </summary>
         public const uint nTargetsSwitchTime = 1374278400;