This commit is contained in:
jl777
2018-04-10 17:49:11 +03:00
parent 0d8ffadc4a
commit 4972b74b60
2 changed files with 27 additions and 21 deletions

View File

@@ -759,28 +759,34 @@ arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t he
if ( percPoS < goalperc ) // increase PoW diff -> lower bnTarget if ( percPoS < goalperc ) // increase PoW diff -> lower bnTarget
{ {
bnTarget = (ave * arith_uint256(goalperc)) / arith_uint256(percPoS + goalperc); bnTarget = (ave * arith_uint256(goalperc)) / arith_uint256(percPoS + goalperc);
for (i=31; i>=24; i--) if ( 0 )
fprintf(stderr,"%02x",((uint8_t *)&ave)[i]); {
fprintf(stderr," increase diff -> "); for (i=31; i>=24; i--)
for (i=31; i>=24; i--) fprintf(stderr,"%02x",((uint8_t *)&ave)[i]);
fprintf(stderr,"%02x",((uint8_t *)&bnTarget)[i]); fprintf(stderr," increase diff -> ");
fprintf(stderr," floor diff "); for (i=31; i>=24; i--)
for (i=31; i>=24; i--) fprintf(stderr,"%02x",((uint8_t *)&bnTarget)[i]);
fprintf(stderr,"%02x",((uint8_t *)&target)[i]); fprintf(stderr," floor diff ");
fprintf(stderr," ht.%d percPoS.%d vs goal.%d -> diff %d\n",height,percPoS,goalperc,goalperc - percPoS); for (i=31; i>=24; i--)
fprintf(stderr,"%02x",((uint8_t *)&target)[i]);
fprintf(stderr," ht.%d percPoS.%d vs goal.%d -> diff %d\n",height,percPoS,goalperc,goalperc - percPoS);
}
} }
else if ( percPoS > goalperc ) // decrease PoW diff -> raise bnTarget else if ( percPoS > goalperc ) // decrease PoW diff -> raise bnTarget
{ {
bnTarget = ((ave * arith_uint256(goalperc)) + (target * arith_uint256(percPoS))) / arith_uint256(percPoS + goalperc); bnTarget = ((ave * arith_uint256(goalperc)) + (target * arith_uint256(percPoS))) / arith_uint256(percPoS + goalperc);
for (i=31; i>=24; i--) if ( 0 )
fprintf(stderr,"%02x",((uint8_t *)&ave)[i]); {
fprintf(stderr," decrease diff -> "); for (i=31; i>=24; i--)
for (i=31; i>=24; i--) fprintf(stderr,"%02x",((uint8_t *)&ave)[i]);
fprintf(stderr,"%02x",((uint8_t *)&bnTarget)[i]); fprintf(stderr," decrease diff -> ");
fprintf(stderr," floor diff "); for (i=31; i>=24; i--)
for (i=31; i>=24; i--) fprintf(stderr,"%02x",((uint8_t *)&bnTarget)[i]);
fprintf(stderr,"%02x",((uint8_t *)&target)[i]); fprintf(stderr," floor diff ");
fprintf(stderr," ht.%d percPoS.%d vs goal.%d -> diff %d\n",height,percPoS,goalperc,goalperc - percPoS); for (i=31; i>=24; i--)
fprintf(stderr,"%02x",((uint8_t *)&target)[i]);
fprintf(stderr," ht.%d percPoS.%d vs goal.%d -> diff %d\n",height,percPoS,goalperc,goalperc - percPoS);
}
} }
else bnTarget = ave; // recent ave is perfect else bnTarget = ave; // recent ave is perfect
return(bnTarget); return(bnTarget);

View File

@@ -100,7 +100,7 @@ public:
void UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams, const CBlockIndex* pindexPrev) void UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams, const CBlockIndex* pindexPrev)
{ {
pblock->nTime = std::max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime()); pblock->nTime = 1 + std::max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
} }
#include "komodo_defs.h" #include "komodo_defs.h"
@@ -902,8 +902,8 @@ void static BitcoinMiner()
solutionTargetChecks.increment(); solutionTargetChecks.increment();
if ( UintToArith256(pblock->GetHash()) > hashTarget ) if ( UintToArith256(pblock->GetHash()) > hashTarget )
{ {
//if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) if ( ASSETCHAINS_SYMBOL[0] != 0 )
// fprintf(stderr," missed target\n"); fprintf(stderr," missed target\n");
return false; return false;
} }
if ( ASSETCHAINS_STAKED == 0 ) if ( ASSETCHAINS_STAKED == 0 )