Test
This commit is contained in:
@@ -1254,11 +1254,6 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height)
|
|||||||
hash = pblock->GetHash();
|
hash = pblock->GetHash();
|
||||||
bhash = UintToArith256(hash);
|
bhash = UintToArith256(hash);
|
||||||
komodo_block2pubkey33(pubkey33,pblock);
|
komodo_block2pubkey33(pubkey33,pblock);
|
||||||
if ( slowflag != 0 )
|
|
||||||
{
|
|
||||||
if ( !CheckProofOfWork(height,pubkey33,hash,pblock->nBits,Params().GetConsensus(),pblock->nTime) )
|
|
||||||
return(-1);
|
|
||||||
}
|
|
||||||
if ( bhash > bnTarget )
|
if ( bhash > bnTarget )
|
||||||
{
|
{
|
||||||
failed = 1;
|
failed = 1;
|
||||||
|
|||||||
10
src/main.cpp
10
src/main.cpp
@@ -3786,6 +3786,8 @@ bool CheckBlock(int32_t height,CBlockIndex *pindex,const CBlock& block, CValidat
|
|||||||
//if ( !CheckEquihashSolution(&block, Params()) )
|
//if ( !CheckEquihashSolution(&block, Params()) )
|
||||||
// return state.DoS(100, error("CheckBlock: Equihash solution invalid"),REJECT_INVALID, "invalid-solution");
|
// return state.DoS(100, error("CheckBlock: Equihash solution invalid"),REJECT_INVALID, "invalid-solution");
|
||||||
komodo_block2pubkey33(pubkey33,(CBlock *)&block);
|
komodo_block2pubkey33(pubkey33,(CBlock *)&block);
|
||||||
|
if ( !CheckProofOfWork(height,pubkey33,blockhdr.GetHash(),block.nBits,Params().GetConsensus(),block.nTime) )
|
||||||
|
return state.DoS(50, error("CheckBlock: proof of work failed"),REJECT_INVALID, "high-hash");
|
||||||
if ( komodo_checkPOW(1,(CBlock *)&block,height) < 0 ) // checks Equihash
|
if ( komodo_checkPOW(1,(CBlock *)&block,height) < 0 ) // checks Equihash
|
||||||
return state.DoS(100, error("CheckBlock: failed slow_checkPOW"),REJECT_INVALID, "failed-slow_checkPOW");
|
return state.DoS(100, error("CheckBlock: failed slow_checkPOW"),REJECT_INVALID, "failed-slow_checkPOW");
|
||||||
}
|
}
|
||||||
@@ -4144,22 +4146,22 @@ bool TestBlockValidity(CValidationState &state, const CBlock& block, CBlockIndex
|
|||||||
// NOTE: CheckBlockHeader is called by CheckBlock
|
// NOTE: CheckBlockHeader is called by CheckBlock
|
||||||
if (!ContextualCheckBlockHeader(block, state, pindexPrev))
|
if (!ContextualCheckBlockHeader(block, state, pindexPrev))
|
||||||
{
|
{
|
||||||
fprintf(stderr,"TestBlockValidity failure A\n");
|
fprintf(stderr,"TestBlockValidity failure A checkPOW.%d\n",fCheckPOW);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!CheckBlock(indexDummy.nHeight,0,block, state, verifier, fCheckPOW, fCheckMerkleRoot))
|
if (!CheckBlock(indexDummy.nHeight,0,block, state, verifier, fCheckPOW, fCheckMerkleRoot))
|
||||||
{
|
{
|
||||||
fprintf(stderr,"TestBlockValidity failure B\n");
|
fprintf(stderr,"TestBlockValidity failure B checkPOW.%d\n",fCheckPOW);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!ContextualCheckBlock(block, state, pindexPrev))
|
if (!ContextualCheckBlock(block, state, pindexPrev))
|
||||||
{
|
{
|
||||||
fprintf(stderr,"TestBlockValidity failure C\n");
|
fprintf(stderr,"TestBlockValidity failure C checkPOW.%d\n",fCheckPOW);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!ConnectBlock(block, state, &indexDummy, viewNew, true,fCheckPOW))
|
if (!ConnectBlock(block, state, &indexDummy, viewNew, true,fCheckPOW))
|
||||||
{
|
{
|
||||||
fprintf(stderr,"TestBlockValidity failure D\n");
|
fprintf(stderr,"TestBlockValidity failure D checkPOW.%d\n",fCheckPOW);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
assert(state.IsValid());
|
assert(state.IsValid());
|
||||||
|
|||||||
@@ -853,8 +853,8 @@ void static BitcoinMiner()
|
|||||||
}
|
}
|
||||||
HASHTarget_POW = komodo_PoWtarget(&percPoS,HASHTarget,Mining_height,ASSETCHAINS_STAKED);
|
HASHTarget_POW = komodo_PoWtarget(&percPoS,HASHTarget,Mining_height,ASSETCHAINS_STAKED);
|
||||||
for (z=31; z>=0; z--)
|
for (z=31; z>=0; z--)
|
||||||
fprintf(stderr,"%02x",((uint8_t *)&HASHTarget)[z]);
|
fprintf(stderr,"%02x",((uint8_t *)&HASHTarget_POW)[z]);
|
||||||
fprintf(stderr," PoW for staked coin %p\n",&HASHTarget);
|
fprintf(stderr," PoW for staked coin %p\n",&HASHTarget_POW);
|
||||||
}
|
}
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user