Browse Source

Test

metaverse
jl777 6 years ago
parent
commit
2a6a442a4e
  1. 16
      src/main.cpp
  2. 18
      src/miner.cpp

16
src/main.cpp

@ -1607,25 +1607,25 @@ bool myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlo
{
// need a GetTransaction without lock so the validation code for assets can run without deadlock
{
fprintf(stderr,"check mempool\n");
//fprintf(stderr,"check mempool\n");
if (mempool.lookup(hash, txOut))
{
fprintf(stderr,"found in mempool\n");
//fprintf(stderr,"found in mempool\n");
return true;
}
}
fprintf(stderr,"check disk\n");
//fprintf(stderr,"check disk\n");
if (fTxIndex) {
CDiskTxPos postx;
fprintf(stderr,"ReadTxIndex\n");
//fprintf(stderr,"ReadTxIndex\n");
if (pblocktree->ReadTxIndex(hash, postx)) {
fprintf(stderr,"OpenBlockFile\n");
//fprintf(stderr,"OpenBlockFile\n");
CAutoFile file(OpenBlockFile(postx, true), SER_DISK, CLIENT_VERSION);
if (file.IsNull())
return error("%s: OpenBlockFile failed", __func__);
CBlockHeader header;
fprintf(stderr,"seek and read\n");
//fprintf(stderr,"seek and read\n");
try {
file >> header;
fseek(file.Get(), postx.nTxOffset, SEEK_CUR);
@ -1636,11 +1636,11 @@ bool myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlo
hashBlock = header.GetHash();
if (txOut.GetHash() != hash)
return error("%s: txid mismatch", __func__);
fprintf(stderr,"found on disk\n");
//fprintf(stderr,"found on disk\n");
return true;
}
}
fprintf(stderr,"not found\n");
//fprintf(stderr,"not found\n");
return false;
}

18
src/miner.cpp

@ -126,7 +126,7 @@ int32_t komodo_notaryvin(CMutableTransaction &txNew,uint8_t *notarypub33);
CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount)
{
uint64_t deposits; int32_t isrealtime,kmdheight; uint32_t blocktime; const CChainParams& chainparams = Params();
fprintf(stderr,"create new block\n");
//fprintf(stderr,"create new block\n");
// Create new block
if ( gpucount < 0 )
gpucount = KOMODO_MAXGPUCOUNT;
@ -497,8 +497,8 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount)
if ( pindexPrev != 0 && ASSETCHAINS_STAKED == 0 )
{
CValidationState state;
fprintf(stderr,"check validity\n");
if ( !TestBlockValidity(state, *pblock, pindexPrev, false, false))
//fprintf(stderr,"check validity\n");
if ( !TestBlockValidity(state, *pblock, pindexPrev, false, false)) // invokes CC checks
{
//static uint32_t counter;
//if ( counter++ < 100 && ASSETCHAINS_STAKED == 0 )
@ -506,9 +506,9 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn,int32_t gpucount)
fprintf(stderr,"invalid\n");
return(0);
}
fprintf(stderr,"valid\n");
//fprintf(stderr,"valid\n");
}
fprintf(stderr,"done new block\n");
//fprintf(stderr,"done new block\n");
return pblocktemplate.release();
}
@ -792,7 +792,7 @@ void static BitcoinMiner()
}
if ( ASSETCHAINS_SYMBOL[0] != 0 && ASSETCHAINS_STAKED == 0 )
{
fprintf(stderr,"%s create new block ht.%d\n",ASSETCHAINS_SYMBOL,Mining_height);
//fprintf(stderr,"%s create new block ht.%d\n",ASSETCHAINS_SYMBOL,Mining_height);
//sleep(3);
}
#ifdef ENABLE_WALLET
@ -808,7 +808,7 @@ void static BitcoinMiner()
sleep(1);
continue;
}
fprintf(stderr,"get template\n");
//fprintf(stderr,"get template\n");
unique_ptr<CBlockTemplate> pblocktemplate(ptr);
if (!pblocktemplate.get())
{
@ -836,7 +836,7 @@ void static BitcoinMiner()
}
}
IncrementExtraNonce(pblock, pindexPrev, nExtraNonce);
fprintf(stderr,"Running KomodoMiner.%s with %u transactions in block\n",solver.c_str(),(int32_t)pblock->vtx.size());
//fprintf(stderr,"Running KomodoMiner.%s with %u transactions in block\n",solver.c_str(),(int32_t)pblock->vtx.size());
LogPrintf("Running KomodoMiner.%s with %u transactions in block (%u bytes)\n",solver.c_str(),pblock->vtx.size(),::GetSerializeSize(*pblock,SER_NETWORK,PROTOCOL_VERSION));
//
// Search
@ -917,7 +917,7 @@ void static BitcoinMiner()
sleep(10);
break;
}*/
fprintf(stderr,"top of while\n");
//fprintf(stderr,"top of while\n");
// Hash state
KOMODO_CHOSEN_ONE = 0;
crypto_generichash_blake2b_state state;

Loading…
Cancel
Save