From 5d3d406c6c8d6c2b533e5f8da35964b51c63aa80 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 7 Aug 2019 12:03:58 -1100 Subject: [PATCH] Average with previous --- src/pow.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/pow.cpp b/src/pow.cpp index 1da1276cd..9e888188e 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -348,7 +348,7 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead } if ( ASSETCHAINS_ADAPTIVEPOW == 1 ) // TSA { - arith_uint256 A,B,C; // fix overflow bug on diff stranding + arith_uint256 A,B,C; if ( tipdiff < 4 ) tipdiff = 4; tipdiff &= ~1; @@ -361,19 +361,13 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead bnTarget = (bnTarget * arith_uint256(2)) / arith_uint256(3); else if ( (ts[0] - ts[1]) > T*2 ) bnTarget = (bnTarget * arith_uint256(3)) / arith_uint256(2); + bnTarget = (bnTarget + ct[0]) / arith_uint256(2); { int32_t z; for (z=31; z>=0; z--) fprintf(stderr,"%02x",((uint8_t *)&bnTarget)[z]); } fprintf(stderr," ht.%d TSA bnTarget tipdiff.%d\n",height,tipdiff); - /*bnTarget = (bnTarget + ct[0] + ct[1] + ct[2]) / arith_uint256(4); - { - int32_t z; - for (z=31; z>=0; z--) - fprintf(stderr,"%02x",((uint8_t *)&bnTarget)[z]); - } - fprintf(stderr," sma\n");*/ nbits = bnTarget.GetCompact(); nbits = (nbits & 0xfffffffc) | 0; return(nbits);