X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fkernel.cpp;h=1d9aa625e88336406087c589b3c81f9db1262825;hb=6145f2d5e9f380a11bce933fe343d48fd8936a33;hp=5970dcfe3a708635b25393bfb4c911f2d4dff295;hpb=b4940b2b63b70263d31e3ff273b16eede991e609;p=novacoin.git diff --git a/src/kernel.cpp b/src/kernel.cpp index 5970dcf..1d9aa62 100644 --- a/src/kernel.cpp +++ b/src/kernel.cpp @@ -9,15 +9,17 @@ using namespace std; -// Modifier interval: time to elapse before new modifier is computed -// Set to 6-hour for production network and 20-minute for test network -unsigned int nModifierInterval = MODIFIER_INTERVAL; +extern int nStakeMaxAge; +extern int nStakeTargetSpacing; // Hard checkpoints of stake modifiers to ensure they are deterministic static std::map mapStakeModifierCheckpoints = boost::assign::map_list_of - ( 0, 0x0e00670bu ) - ( 6000, 0xb7cbc5d3u ) + ( 0, 0x0e00670bu ) + ( 6000, 0xb7cbc5d3u ) + ( 9690, 0x97dcdafau ) + ( 12661, 0x5d84115du ) + ( 19600, 0xdded1b8du ) ; // Get the last stake modifier and its generation time from a given block @@ -135,7 +137,7 @@ bool ComputeNextStakeModifier(const CBlockIndex* pindexPrev, uint64& nStakeModif // Sort candidate blocks by timestamp vector > vSortedByTimestamp; - vSortedByTimestamp.reserve(64 * nModifierInterval / STAKE_TARGET_SPACING); + vSortedByTimestamp.reserve(64 * nModifierInterval / nStakeTargetSpacing); int64 nSelectionInterval = GetStakeModifierSelectionInterval(); int64 nSelectionIntervalStart = (pindexPrev->GetBlockTime() / nModifierInterval) * nModifierInterval - nSelectionInterval; const CBlockIndex* pindex = pindexPrev; @@ -273,7 +275,7 @@ bool CheckStakeKernelHash(unsigned int nBits, const CBlock& blockFrom, unsigned // v0.3 protocol kernel hash weight starts from 0 at the 30-day min age // this change increases active coins participating the hash and helps // to secure the network when proof-of-stake difficulty is low - int64 nTimeWeight = min((int64)nTimeTx - txPrev.nTime, (int64)STAKE_MAX_AGE) - nStakeMinAge; + int64 nTimeWeight = min((int64)nTimeTx - txPrev.nTime, (int64)nStakeMaxAge) - nStakeMinAge; CBigNum bnCoinDayWeight = CBigNum(nValueIn) * nTimeWeight / COIN / (24 * 60 * 60); // Calculate hash @@ -363,7 +365,7 @@ bool CheckCoinStakeTimestamp(int64 nTimeBlock, int64 nTimeTx) // Get stake modifier checksum unsigned int GetStakeModifierChecksum(const CBlockIndex* pindex) { - assert (pindex->pprev || pindex->GetBlockHash() == hashGenesisBlock); + assert (pindex->pprev || pindex->GetBlockHash() == (!fTestNet ? hashGenesisBlock : hashGenesisBlockTestNet)); // Hash previous checksum with flags, hashProofOfStake and nStakeModifier CDataStream ss(SER_GETHASH, 0); if (pindex->pprev)