Easy diff for PoS
This commit is contained in:
@@ -1200,7 +1200,7 @@ uint32_t komodo_stake(int32_t validateflag,arith_uint256 bnTarget,int32_t nHeigh
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//fprintf(stderr,"iterated until i.%d winner.%d\n",i,winner);
|
//fprintf(stderr,"iterated until i.%d winner.%d\n",i,winner);
|
||||||
if ( 0 )
|
if ( 1 )
|
||||||
{
|
{
|
||||||
for (i=31; i>=24; i--)
|
for (i=31; i>=24; i--)
|
||||||
fprintf(stderr,"%02x",((uint8_t *)&hashval)[i]);
|
fprintf(stderr,"%02x",((uint8_t *)&hashval)[i]);
|
||||||
|
|||||||
@@ -8,6 +8,5 @@
|
|||||||
#define KOMODO_LIMITED_NETWORKSIZE 4
|
#define KOMODO_LIMITED_NETWORKSIZE 4
|
||||||
#define KOMODO_MAXMEMPOOLTIME 3600 // affects consensus
|
#define KOMODO_MAXMEMPOOLTIME 3600 // affects consensus
|
||||||
#define CRYPTO777_PUBSECPSTR "020e46e79a2a8d12b9b5d12c7a91adb4e454edfae43c0a0cb805427d2ac7613fd9"
|
#define CRYPTO777_PUBSECPSTR "020e46e79a2a8d12b9b5d12c7a91adb4e454edfae43c0a0cb805427d2ac7613fd9"
|
||||||
#define KOMODO_MAXPOS_DIFF 16
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -889,10 +889,7 @@ void static BitcoinMiner()
|
|||||||
{
|
{
|
||||||
int32_t percPoS,z; bool fNegative,fOverflow;
|
int32_t percPoS,z; bool fNegative,fOverflow;
|
||||||
HASHTarget_POW = komodo_PoWtarget(&percPoS,HASHTarget,Mining_height,ASSETCHAINS_STAKED);
|
HASHTarget_POW = komodo_PoWtarget(&percPoS,HASHTarget,Mining_height,ASSETCHAINS_STAKED);
|
||||||
bnMaxPoSdiff.SetCompact(KOMODO_MINDIFF_NBITS,&fNegative,&fOverflow);
|
HASHTarget.SetCompact(KOMODO_MINDIFF_NBITS,&fNegative,&fOverflow);
|
||||||
bnMaxPoSdiff = (bnMaxPoSdiff / arith_uint256(KOMODO_MAXPOS_DIFF));
|
|
||||||
if ( HASHTarget < bnMaxPoSdiff )
|
|
||||||
HASHTarget = bnMaxPoSdiff;
|
|
||||||
if ( ASSETCHAINS_STAKED < 100 )
|
if ( ASSETCHAINS_STAKED < 100 )
|
||||||
{
|
{
|
||||||
for (z=31; z>=0; z--)
|
for (z=31; z>=0; z--)
|
||||||
|
|||||||
@@ -127,7 +127,6 @@ extern int32_t KOMODO_CHOSEN_ONE;
|
|||||||
extern uint64_t ASSETCHAINS_STAKED;
|
extern uint64_t ASSETCHAINS_STAKED;
|
||||||
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
|
extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
|
||||||
#define KOMODO_ELECTION_GAP 2000
|
#define KOMODO_ELECTION_GAP 2000
|
||||||
#define KOMODO_MAXPOS_DIFF 16
|
|
||||||
|
|
||||||
int32_t komodo_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,uint32_t blocktimes[66],int32_t *nonzpkeysp,int32_t height);
|
int32_t komodo_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,uint32_t blocktimes[66],int32_t *nonzpkeysp,int32_t height);
|
||||||
int32_t KOMODO_LOADINGBLOCKS = 1;
|
int32_t KOMODO_LOADINGBLOCKS = 1;
|
||||||
@@ -194,10 +193,7 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash,unsigned int
|
|||||||
if ( ASSETCHAINS_STAKED != 0 )
|
if ( ASSETCHAINS_STAKED != 0 )
|
||||||
{
|
{
|
||||||
arith_uint256 bnMaxPoSdiff;
|
arith_uint256 bnMaxPoSdiff;
|
||||||
bnMaxPoSdiff.SetCompact(KOMODO_MINDIFF_NBITS,&fNegative,&fOverflow);
|
bnTarget.SetCompact(KOMODO_MINDIFF_NBITS,&fNegative,&fOverflow);
|
||||||
bnMaxPoSdiff = (bnMaxPoSdiff / arith_uint256(KOMODO_MAXPOS_DIFF));
|
|
||||||
if ( bnTarget < bnMaxPoSdiff )
|
|
||||||
bnTarget = bnMaxPoSdiff;
|
|
||||||
}
|
}
|
||||||
// Check proof of work matches claimed amount
|
// Check proof of work matches claimed amount
|
||||||
if ( UintToArith256(hash) > bnTarget )
|
if ( UintToArith256(hash) > bnTarget )
|
||||||
|
|||||||
Reference in New Issue
Block a user