test
This commit is contained in:
14
src/komodo.h
14
src/komodo.h
@@ -544,12 +544,20 @@ void komodo_block2pubkey33(uint8_t *pubkey33,CBlock& block)
|
||||
memcpy(pubkey33,ptr+1,33);
|
||||
}
|
||||
|
||||
void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex)
|
||||
void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height)
|
||||
{
|
||||
CBlock block;
|
||||
memset(pubkey33,0,33);
|
||||
if ( pindex != 0 && ReadBlockFromDisk(block,(const CBlockIndex *)pindex) != 0 )
|
||||
komodo_block2pubkey33(pubkey33,block);
|
||||
if ( pindex != 0 )
|
||||
{
|
||||
if ( ReadBlockFromDisk(block,(const CBlockIndex *)pindex) != 0 )
|
||||
komodo_block2pubkey33(pubkey33,block);
|
||||
}
|
||||
else
|
||||
{
|
||||
// height -> pubkey33
|
||||
printf("komodo_index2pubkey33 height.%d need to get pubkey33\n",height);
|
||||
}
|
||||
}
|
||||
|
||||
/*int32_t komodo_blockindexcheck(CBlockIndex *pindex,uint32_t *nBitsp)
|
||||
|
||||
@@ -2961,7 +2961,7 @@ bool CheckBlockHeader(int32_t height,CBlockIndex *pindex, const CBlockHeader& bl
|
||||
return state.DoS(100, error("CheckBlockHeader(): Equihash solution invalid"),REJECT_INVALID, "invalid-solution");
|
||||
|
||||
// Check proof of work matches claimed amount
|
||||
komodo_index2pubkey33(pubkey33,pindex);
|
||||
komodo_index2pubkey33(pubkey33,pindex,height);
|
||||
if ( fCheckPOW && !CheckProofOfWork(height:0,pubkey33,blockhdr.GetHash(), blockhdr.nBits, Params().GetConsensus()) )
|
||||
return state.DoS(50, error("CheckBlockHeader(): proof of work failed"),REJECT_INVALID, "high-hash");
|
||||
return true;
|
||||
|
||||
@@ -410,7 +410,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
|
||||
|
||||
/** Context-independent validity checks */
|
||||
bool CheckBlockHeader(CBlockIndex *pindex,const CBlock& block, const CBlockHeader& blockhdr, CValidationState& state, bool fCheckPOW = true);
|
||||
bool CheckBlock(int32_t height,const CBlock& block, CValidationState& state, bool fCheckPOW = true, bool fCheckMerkleRoot = true);
|
||||
bool CheckBlock(int32_t height,CBlockIndex *pindex,const CBlock& block, CValidationState& state, bool fCheckPOW = true, bool fCheckMerkleRoot = true);
|
||||
|
||||
/** Context-dependent validity checks */
|
||||
bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& state, CBlockIndex *pindexPrev);
|
||||
|
||||
Reference in New Issue
Block a user