test
This commit is contained in:
10
src/pow.cpp
10
src/pow.cpp
@@ -122,7 +122,12 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in
|
|||||||
fprintf(stderr," height.%d special.%d\n",height,special);
|
fprintf(stderr," height.%d special.%d\n",height,special);
|
||||||
if ( special < 0 )
|
if ( special < 0 )
|
||||||
bnTarget /= 8;
|
bnTarget /= 8;
|
||||||
else bnTarget.SetCompact(KOMODO_MINDIFF_NBITS,&fNegative,&fOverflow);
|
else
|
||||||
|
{
|
||||||
|
if (UintToArith256(hash) <= bnTarget) // accept normal diff
|
||||||
|
return true;
|
||||||
|
bnTarget.SetCompact(KOMODO_MINDIFF_NBITS,&fNegative,&fOverflow);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check range
|
// Check range
|
||||||
@@ -131,8 +136,9 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in
|
|||||||
|
|
||||||
// Check proof of work matches claimed amount
|
// Check proof of work matches claimed amount
|
||||||
if (UintToArith256(hash) > bnTarget)
|
if (UintToArith256(hash) > bnTarget)
|
||||||
|
{
|
||||||
return error("CheckProofOfWork(): hash doesn't match nBits");
|
return error("CheckProofOfWork(): hash doesn't match nBits");
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -266,8 +266,6 @@ bool CBlockTreeDB::ReadFlag(const std::string &name, bool &fValue) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t komodo_blockindexcheck(CBlockIndex *pindex,uint32_t *nBitsp);
|
|
||||||
|
|
||||||
bool CBlockTreeDB::LoadBlockIndexGuts()
|
bool CBlockTreeDB::LoadBlockIndexGuts()
|
||||||
{
|
{
|
||||||
boost::scoped_ptr<leveldb::Iterator> pcursor(NewIterator());
|
boost::scoped_ptr<leveldb::Iterator> pcursor(NewIterator());
|
||||||
@@ -308,7 +306,7 @@ bool CBlockTreeDB::LoadBlockIndexGuts()
|
|||||||
pindexNew->nTx = diskindex.nTx;
|
pindexNew->nTx = diskindex.nTx;
|
||||||
uint8_t pubkey33[33];
|
uint8_t pubkey33[33];
|
||||||
komodo_index2pubkey33(pubkey33,pindexNew);
|
komodo_index2pubkey33(pubkey33,pindexNew);
|
||||||
if (!CheckProofOfWork(pindexNew->height,pubkey33,pindexNew->GetBlockHash(), pindexNew->nBits, Params().GetConsensus()))
|
if (!CheckProofOfWork(pindexNew->nHeight,pubkey33,pindexNew->GetBlockHash(), pindexNew->nBits, Params().GetConsensus()))
|
||||||
return error("LoadBlockIndex(): CheckProofOfWork failed: %s", pindexNew->ToString());
|
return error("LoadBlockIndex(): CheckProofOfWork failed: %s", pindexNew->ToString());
|
||||||
pcursor->Next();
|
pcursor->Next();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user