Fix merkleNode exceptions.
[NovacoinLibrary.git] / Novacoin / CBlockStore.cs
index 97ce54e..604df45 100644 (file)
@@ -904,10 +904,9 @@ namespace Novacoin
                         return false; // unable to get coin age for coinstake
                     }
 
-                    int nTxSize = (tx.nTime > NetInfo.nStakeValidationSwitchTime) ? tx.Size : 0;
                     ulong nReward = tx.nValueOut - nValueIn;
 
-                    ulong nCalculatedReward = CBlock.GetProofOfStakeReward(nCoinAge, cursorBlock.nBits, tx.nTime) - CTransaction.GetMinFee(1, false, CTransaction.MinFeeMode.GMF_BLOCK, nTxSize) + CTransaction.nCent;
+                    ulong nCalculatedReward = CBlock.GetProofOfStakeReward(nCoinAge, cursorBlock.nBits, tx.nTime) - tx.GetMinFee(1, false, CTransaction.MinFeeMode.GMF_BLOCK) + CTransaction.nCent;
 
                     if (nReward > nCalculatedReward)
                     {
@@ -1135,6 +1134,8 @@ namespace Novacoin
                 var results = blockMap.Where(x => x.Value.ItemID == merkleNode.nParentBlockID).Select(x => x.Value).ToArray();
 
                 blockCursor = results[0];
+
+                return merkleNode;
             }
 
             // Nothing found.