From 3c8a1c9d1fe2c02ef8bdea6f9ba0ad774379f55c Mon Sep 17 00:00:00 2001 From: Michael Toutonghi Date: Sun, 20 May 2018 11:42:41 -0700 Subject: [PATCH] Change name and off-by-one to make compatible with dry-run chain --- src/komodo_globals.h | 2 +- src/pow.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/komodo_globals.h b/src/komodo_globals.h index 1ef813085..d4609d844 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -82,7 +82,7 @@ uint32_t ASSETCHAINS_ALGO = _ASSETCHAINS_EQUIHASH; int32_t ASSETCHAINS_LWMAPOS = 0; // percentage of blocks should be PoS int32_t VERUS_BLOCK_POSUNITS = 1024; // one block is 1000 units int32_t VERUS_MIN_STAKEAGE = 150; // 1/2 this should also be a cap on the POS averaging window, or startup could be too easy -int32_t VERUS_MAX_CONSECUTIVE_POS = 7; +int32_t VERUS_CONSECUTIVE_POS_THRESHOLD = 7; int32_t VERUS_NOPOS_THRESHHOLD = 150; // if we have no POS blocks in this many blocks, set to default difficulty uint64_t KOMODO_INTERESTSUM,KOMODO_WALLETBALANCE; diff --git a/src/pow.cpp b/src/pow.cpp index e4579c6ce..5055eb20c 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -22,7 +22,7 @@ uint32_t komodo_chainactive_timestamp(); extern uint32_t ASSETCHAINS_ALGO, ASSETCHAINS_EQUIHASH; -extern int32_t VERUS_BLOCK_POSUNITS, VERUS_MAX_CONSECUTIVE_POS, VERUS_NOPOS_THRESHHOLD; +extern int32_t VERUS_BLOCK_POSUNITS, VERUS_CONSECUTIVE_POS_THRESHOLD, VERUS_NOPOS_THRESHHOLD; unsigned int lwmaGetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params); unsigned int lwmaCalculateNextWorkRequired(const CBlockIndex* pindexLast, const Consensus::Params& params); @@ -210,7 +210,7 @@ uint32_t lwmaGetNextPOSRequired(const CBlockIndex* pindexLast, const Consensus:: // we measure our solve time in passing of blocks, where one bock == VERUS_BLOCK_POSUNITS units // consecutive blocks in either direction have their solve times exponentially multiplied or divided by power of 2 int x; - for (x = 0; x < VERUS_MAX_CONSECUTIVE_POS; x++) + for (x = 0; x < VERUS_CONSECUTIVE_POS_THRESHOLD; x++) { pindexFirst = pindexFirst->pprev; @@ -243,7 +243,7 @@ uint32_t lwmaGetNextPOSRequired(const CBlockIndex* pindexLast, const Consensus:: if (idx[j].consecutive == true) { idx[j].solveTime = st; - if (((j - i) + 1) >= VERUS_MAX_CONSECUTIVE_POS) + if ((j - i) >= VERUS_CONSECUTIVE_POS_THRESHOLD) { // if this is real time, return zero if (i == (N - 1))