This commit is contained in:
jl777
2016-10-20 07:35:11 -03:00
parent 9ebb63d751
commit c322824d31

View File

@@ -114,22 +114,21 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in
arith_uint256 bnTarget; arith_uint256 bnTarget;
bnTarget.SetCompact(nBits, &fNegative, &fOverflow); bnTarget.SetCompact(nBits, &fNegative, &fOverflow);
if ( (special= komodo_heightnotary(height,pubkey33)) != 0 ) if ( (special= komodo_heightnotary(height,pubkey33)) != 0 ) // 0 -> non-special notary
{ {
int32_t i; int32_t i;
for (i=0; i<33; i++) for (i=0; i<33; i++)
fprintf(stderr,"%02x",pubkey33[i]); fprintf(stderr,"%02x",pubkey33[i]);
fprintf(stderr," height.%d special.%d\n",height,special); fprintf(stderr," height.%d special.%d\n",height,special);
if ( special < 0 ) if ( special < 0 ) // non-notary node
bnTarget /= 8; bnTarget /= 8;
else else // special notary id == (height % numnotaries)
{ {
if (UintToArith256(hash) <= bnTarget) // accept normal diff if (UintToArith256(hash) <= bnTarget) // accept normal diff
return true; return true;
bnTarget.SetCompact(KOMODO_MINDIFF_NBITS,&fNegative,&fOverflow); bnTarget.SetCompact(KOMODO_MINDIFF_NBITS,&fNegative,&fOverflow);
} }
} }
// Check range // Check range
if (fNegative || bnTarget == 0 || fOverflow || bnTarget > UintToArith256(params.powLimit)) if (fNegative || bnTarget == 0 || fOverflow || bnTarget > UintToArith256(params.powLimit))
return error("CheckProofOfWork(): nBits below minimum work"); return error("CheckProofOfWork(): nBits below minimum work");