Browse Source

test

pull/4/head
jl777 6 years ago
parent
commit
80afe35bdc
  1. 4
      src/main.cpp
  2. 19
      src/pow.cpp

4
src/main.cpp

@ -3789,9 +3789,9 @@ bool CheckBlock(int32_t height,CBlockIndex *pindex,const CBlock& block, CValidat
if ( !CheckProofOfWork(height,pubkey33,block.GetHash(),block.nBits,Params().GetConsensus(),block.nTime) )
{
int32_t z; uint256 h = block.GetHash();
for (z=0; z<32; z++)
for (z=31; z>=0; z--)
fprintf(stderr,"%02x",((uint8_t *)&h)[z]);
fprintf(stderr," failed hash\n");
fprintf(stderr," failed hash ht.%d\n",height);
return state.DoS(50, error("CheckBlock: proof of work failed"),REJECT_INVALID, "high-hash");
}
if ( komodo_checkPOW(1,(CBlock *)&block,height) < 0 ) // checks Equihash

19
src/pow.cpp

@ -136,6 +136,9 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash,unsigned int
extern int32_t KOMODO_REWIND;
bool fNegative,fOverflow; uint8_t origpubkey33[33]; int32_t i,nonzpkeys=0,nonz=0,special=0,special2=0,notaryid=-1,flag = 0, mids[66]; uint32_t tiptime,blocktimes[66];
arith_uint256 bnTarget; uint8_t pubkeys[66][33];
for (i=31; i>=0; i--)
fprintf(stderr,"%02x",((uint8_t *)&hash)[i]);
fprintf(stderr," checkpow\n");
memcpy(origpubkey33,pubkey33,33);
memset(blocktimes,0,sizeof(blocktimes));
tiptime = komodo_chainactive_timestamp();
@ -195,17 +198,17 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash,unsigned int
//if ( 0 && height > 792000 )
{
for (i=31; i>=0; i--)
printf("%02x",((uint8_t *)&hash)[i]);
printf(" hash vs ");
fprintf(stderr,"%02x",((uint8_t *)&hash)[i]);
fprintf(stderr," hash vs ");
for (i=31; i>=0; i--)
printf("%02x",((uint8_t *)&bnTarget)[i]);
printf(" ht.%d special.%d notaryid.%d ht.%d mod.%d error\n",height,special,notaryid,height,(height % 35));
fprintf(stderr,"%02x",((uint8_t *)&bnTarget)[i]);
fprintf(stderr," ht.%d special.%d notaryid.%d ht.%d mod.%d error\n",height,special,notaryid,fheight,(height % 35));
for (i=0; i<33; i++)
printf("%02x",pubkey33[i]);
printf(" <- pubkey\n");
fprintf(stderr,"%02x",pubkey33[i]);
fprintf(stderr," <- pubkey\n");
for (i=0; i<33; i++)
printf("%02x",origpubkey33[i]);
printf(" <- origpubkey\n");
fprintf(stderr,"%02x",origpubkey33[i]);
fprintf(stderr," <- origpubkey\n");
}
return false;
}

Loading…
Cancel
Save