test
This commit is contained in:
@@ -1342,7 +1342,7 @@ bool ReadBlockFromDisk(int32_t height,CBlock& block, const CDiskBlockPos& pos)
|
|||||||
CAutoFile filein(OpenBlockFile(pos, true), SER_DISK, CLIENT_VERSION);
|
CAutoFile filein(OpenBlockFile(pos, true), SER_DISK, CLIENT_VERSION);
|
||||||
if (filein.IsNull())
|
if (filein.IsNull())
|
||||||
{
|
{
|
||||||
fprintf(stderr,"readblockfromdisk err A\n");
|
//fprintf(stderr,"readblockfromdisk err A\n");
|
||||||
return error("ReadBlockFromDisk: OpenBlockFile failed for %s", pos.ToString());
|
return error("ReadBlockFromDisk: OpenBlockFile failed for %s", pos.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1355,7 +1355,6 @@ bool ReadBlockFromDisk(int32_t height,CBlock& block, const CDiskBlockPos& pos)
|
|||||||
return error("%s: Deserialize or I/O error - %s at %s", __func__, e.what(), pos.ToString());
|
return error("%s: Deserialize or I/O error - %s at %s", __func__, e.what(), pos.ToString());
|
||||||
}
|
}
|
||||||
// Check the header
|
// Check the header
|
||||||
printf("from readblock\n");
|
|
||||||
komodo_block2pubkey33(pubkey33,block);
|
komodo_block2pubkey33(pubkey33,block);
|
||||||
if (!(CheckEquihashSolution(&block, Params()) && CheckProofOfWork(height,pubkey33,block.GetHash(), block.nBits, Params().GetConsensus())))
|
if (!(CheckEquihashSolution(&block, Params()) && CheckProofOfWork(height,pubkey33,block.GetHash(), block.nBits, Params().GetConsensus())))
|
||||||
return error("ReadBlockFromDisk: Errors in block header at %s", pos.ToString());
|
return error("ReadBlockFromDisk: Errors in block header at %s", pos.ToString());
|
||||||
@@ -2966,7 +2965,7 @@ bool CheckBlockHeader(int32_t height,CBlockIndex *pindex, const CBlockHeader& bl
|
|||||||
return state.DoS(100, error("CheckBlockHeader(): Equihash solution invalid"),REJECT_INVALID, "invalid-solution");
|
return state.DoS(100, error("CheckBlockHeader(): Equihash solution invalid"),REJECT_INVALID, "invalid-solution");
|
||||||
|
|
||||||
// Check proof of work matches claimed amount
|
// Check proof of work matches claimed amount
|
||||||
printf("from checkblockheader pindex.%p %p\n",pindex,mapBlockIndex[blockhdr.GetHash()]);
|
//printf("from checkblockheader pindex.%p %p\n",pindex,mapBlockIndex[blockhdr.GetHash()]);
|
||||||
if ( pindex == 0 )
|
if ( pindex == 0 )
|
||||||
pindex = mapBlockIndex[blockhdr.GetHash()];
|
pindex = mapBlockIndex[blockhdr.GetHash()];
|
||||||
komodo_index2pubkey33(pubkey33,pindex,height);
|
komodo_index2pubkey33(pubkey33,pindex,height);
|
||||||
@@ -3155,7 +3154,6 @@ bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, CBloc
|
|||||||
return false;
|
return false;
|
||||||
if (pindex == NULL)
|
if (pindex == NULL)
|
||||||
pindex = AddToBlockIndex(block);
|
pindex = AddToBlockIndex(block);
|
||||||
printf("from AcceptBlock\n");
|
|
||||||
if (!CheckBlockHeader(pindex->nHeight,pindex, block, state))
|
if (!CheckBlockHeader(pindex->nHeight,pindex, block, state))
|
||||||
return false;
|
return false;
|
||||||
if (ppindex)
|
if (ppindex)
|
||||||
@@ -3169,7 +3167,6 @@ bool AcceptBlock(CBlock& block, CValidationState& state, CBlockIndex** ppindex,
|
|||||||
AssertLockHeld(cs_main);
|
AssertLockHeld(cs_main);
|
||||||
|
|
||||||
CBlockIndex *&pindex = *ppindex;
|
CBlockIndex *&pindex = *ppindex;
|
||||||
printf("from acceptblock\n");
|
|
||||||
if (!AcceptBlockHeader(block, state, &pindex))
|
if (!AcceptBlockHeader(block, state, &pindex))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -3243,7 +3240,6 @@ static bool IsSuperMajority(int minVersion, const CBlockIndex* pstart, unsigned
|
|||||||
bool ProcessNewBlock(CValidationState &state, CNode* pfrom, CBlock* pblock, bool fForceProcessing, CDiskBlockPos *dbp)
|
bool ProcessNewBlock(CValidationState &state, CNode* pfrom, CBlock* pblock, bool fForceProcessing, CDiskBlockPos *dbp)
|
||||||
{
|
{
|
||||||
// Preliminary checks
|
// Preliminary checks
|
||||||
printf("ProcessNewBlock\n");
|
|
||||||
bool checked = CheckBlock(komodo_block2height(pblock),0,*pblock, state);
|
bool checked = CheckBlock(komodo_block2height(pblock),0,*pblock, state);
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
10
src/pow.cpp
10
src/pow.cpp
@@ -114,10 +114,16 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in
|
|||||||
bnTarget.SetCompact(nBits, &fNegative, &fOverflow);
|
bnTarget.SetCompact(nBits, &fNegative, &fOverflow);
|
||||||
if ( (special= komodo_heightnotary(height,pubkey33)) != 0 ) // 0 -> non-special notary
|
if ( (special= komodo_heightnotary(height,pubkey33)) != 0 ) // 0 -> non-special notary
|
||||||
{
|
{
|
||||||
int32_t i;
|
int32_t i,nonz = 0;
|
||||||
for (i=0; i<33; i++)
|
for (i=0; i<33; i++)
|
||||||
|
{
|
||||||
|
if ( pubkey33[i] != 0 )
|
||||||
|
nonz++;
|
||||||
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 nonz.%d\n",height,special,nonz);
|
||||||
|
if ( nonz == 0 )
|
||||||
|
return(true);
|
||||||
if ( special < 0 ) // non-notary node
|
if ( special < 0 ) // non-notary node
|
||||||
bnTarget /= 8;
|
bnTarget /= 8;
|
||||||
else // special notary id == (height % numnotaries)
|
else // special notary id == (height % numnotaries)
|
||||||
|
|||||||
Reference in New Issue
Block a user