From cee26803b11305ff81a8181acd827a2b803e0c69 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 3 Aug 2019 23:31:29 -1100 Subject: [PATCH] Tipdiff decay --- src/miner.cpp | 4 ++-- src/pow.cpp | 13 +++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index e4eb84e8e..5b0d2658f 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -1920,8 +1920,8 @@ void static BitcoinMiner() if ( !TestBlockValidity(state,B, chainActive.LastTip(), true, false)) { h = UintToArith256(B.GetHash()); - for (z=31; z>=0; z--) - fprintf(stderr,"%02x",((uint8_t *)&h)[z]); + //for (z=31; z>=0; z--) + // fprintf(stderr,"%02x",((uint8_t *)&h)[z]); //fprintf(stderr," Invalid block mined, try again\n"); gotinvalid = 1; return(false); diff --git a/src/pow.cpp b/src/pow.cpp index 7cf13fb10..63a396ec8 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -168,8 +168,9 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead fprintf(stderr,"%02x",((uint8_t *)&bnTarget)[z]); } fprintf(stderr," ht.%d booster triggered 2x\n",(int32_t)pindexLast->GetHeight()+1); + flag = -1; } - if ( flag == 0 ) + if ( flag <= 0 ) { bnSum4 = zawy_targetMA(easy,bnSum4,4,block4diff * 5,1); bnSum7 = zawy_targetMA(easy,bnSum7,7,block7diff * 3,1); @@ -184,13 +185,13 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead flag = 1; bnTarget = (bnTmp + bnPrev) / arith_uint256(2); fprintf(stderr,"ht.%d block12diff %d vs %d, make harder\n",(int32_t)pindexLast->GetHeight()+1,block12diff,ASSETCHAINS_BLOCKTIME*11); - if ( 0 ) + if ( flag < 0 ) { - fprintf(stderr,"booster block3sum.%d block6sum.%d tipdiff.%d -> %d\n",block3sum,block6sum,tipdiff,1000*tipdiff/180); - if ( 0 && 1000*tipdiff/180 < 1000 ) + //fprintf(stderr,"booster block3sum.%d block6sum.%d tipdiff.%d -> %d\n",block3sum,block6sum,tipdiff,1000*tipdiff/120); + if ( 1000*tipdiff/120 < 1000 ) { - fprintf(stderr,"special booster block3sum.%d block6sum.%d tipdiff.%d -> %d\n",block3sum,block6sum,tipdiff,1000*tipdiff/180); - bnTarget = bnTarget * arith_uint256(1000*tipdiff/180) / arith_uint256(1000); + fprintf(stderr,"special booster block3sum.%d block6sum.%d tipdiff.%d -> %.3f\n",block3sum,block6sum,tipdiff,(double)tipdiff/120); + bnTarget = bnTarget * arith_uint256(1000*tipdiff/120) / arith_uint256(1000); } } }