test print

This commit is contained in:
jl777
2016-09-14 12:59:08 -03:00
parent a42912d644
commit 7d36ed9e1d
3 changed files with 13 additions and 4 deletions

View File

@@ -86,7 +86,7 @@ addnode="78.47.196.146"
Start mining: Start mining:
komodo/src/komodod -gen=1 -genproclimit=1 komodo/src/komodod -gen=1 -genproclimit=1 -addnode="78.47.196.146"
komodo/src/komodo-cli getinfo komodo/src/komodo-cli getinfo
``` ```

View File

@@ -28,7 +28,9 @@ int32_t komodo_checkmsg(void *bitcoinpeer,uint8_t *data,int32_t datalen)
int32_t komodo_blockcheck(void *block) int32_t komodo_blockcheck(void *block)
{ {
//fprintf(stderr,"check block %p\n",block); //fprintf(stderr,"check block %p\n",block);
return(-1); // 1 -> valid notary block
// -1 -> invalid, ie, prior to notarized block
return(0);
} }
#endif #endif

View File

@@ -1334,6 +1334,7 @@ bool WriteBlockToDisk(CBlock& block, CDiskBlockPos& pos, const CMessageHeader::M
bool ReadBlockFromDisk(CBlock& block, const CDiskBlockPos& pos) bool ReadBlockFromDisk(CBlock& block, const CDiskBlockPos& pos)
{ {
int32_t retval;
block.SetNull(); block.SetNull();
// Open history file to read // Open history file to read
@@ -1350,12 +1351,14 @@ bool ReadBlockFromDisk(CBlock& block, const CDiskBlockPos& pos)
} }
// Check the header // Check the header
if ( komodo_blockcheck((void *)&block) < 0 ) if ( (retval= komodo_blockcheck((void *)&block)) == 0 )
{ {
if (!(CheckEquihashSolution(&block, Params()) && if (!(CheckEquihashSolution(&block, Params()) &&
CheckProofOfWork(block.GetHash(), block.nBits, Params().GetConsensus()))) CheckProofOfWork(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());
} }
else if ( retval < 0 )
return(false);
return true; return true;
} }
@@ -2942,7 +2945,8 @@ bool FindUndoPos(CValidationState &state, int nFile, CDiskBlockPos &pos, unsigne
bool CheckBlockHeader(const CBlockHeader& block, CValidationState& state, bool fCheckPOW) bool CheckBlockHeader(const CBlockHeader& block, CValidationState& state, bool fCheckPOW)
{ {
if ( komodo_blockcheck((void *)&block) < 0 ) int32_t retval;
if ( (retval= komodo_blockcheck((void *)&block)) == 0 )
{ {
// Check Equihash solution is valid // Check Equihash solution is valid
if (fCheckPOW && !CheckEquihashSolution(&block, Params())) if (fCheckPOW && !CheckEquihashSolution(&block, Params()))
@@ -2954,6 +2958,9 @@ bool CheckBlockHeader(const CBlockHeader& block, CValidationState& state, bool f
return state.DoS(50, error("CheckBlockHeader(): proof of work failed"), return state.DoS(50, error("CheckBlockHeader(): proof of work failed"),
REJECT_INVALID, "high-hash"); REJECT_INVALID, "high-hash");
} }
else if ( retval < 0 ) // komodo rejects block, ie. prior to notarized blockhash
return(false);
// Check timestamp // Check timestamp
if (block.GetBlockTime() > GetAdjustedTime() + 600) if (block.GetBlockTime() > GetAdjustedTime() + 600)
return state.Invalid(error("CheckBlockHeader(): block timestamp too far in the future"), return state.Invalid(error("CheckBlockHeader(): block timestamp too far in the future"),