From 0643f3082f36e4f09bf661ab4e1ac41817edb383 Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 13 Aug 2013 22:29:05 +0400 Subject: [PATCH] Fix TimeWeight calculation TimeWeight is currently limited to 60 days due to inaccurracy. This will be corrected since 01 Jan 2014. --- src/kernel.cpp | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/kernel.cpp b/src/kernel.cpp index 89ffdab..b98b7ba 100644 --- a/src/kernel.cpp +++ b/src/kernel.cpp @@ -280,12 +280,16 @@ bool CheckStakeKernelHash(unsigned int nBits, const CBlock& blockFrom, unsigned // this change increases active coins participating the hash and helps // to secure the network when proof-of-stake difficulty is low // - // Disabled for the moment, needs some discussion. That's planned to make this active since 01 Jan 2014 - - if(fTestNet || (false && STAKEWEIGHT_SWITCH_TIME < nTimeTx)) + if(fTestNet || (STAKEWEIGHT_SWITCH_TIME < nTimeTx)) + { + // New rule since 01 Jan 2014: Maximum TimeWeight is 90 days. nTimeWeight = min((int64)nTimeTx - txPrev.nTime - nStakeMinAge, (int64)nStakeMaxAge); + } else + { + // Current rule: Maximum TimeWeight is 60 days. nTimeWeight = min((int64)nTimeTx - txPrev.nTime, (int64)nStakeMaxAge) - nStakeMinAge; + } CBigNum bnCoinDayWeight = CBigNum(nValueIn) * nTimeWeight / COIN / (24 * 60 * 60); -- 1.7.1