Reduce miner created latency
This commit is contained in:
@@ -680,7 +680,8 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
komodo_rwccdata(ASSETCHAINS_SYMBOL,1,&ccdata,&MoMoMdata);
|
komodo_rwccdata(ASSETCHAINS_SYMBOL,1,&ccdata,&MoMoMdata);
|
||||||
printf("[%s] matched.%d VALID (%s) MoM.%s [%d]\n",ASSETCHAINS_SYMBOL,matched,ccdata.symbol,MoM.ToString().c_str(),MoMdepth);
|
if ( matched != 0 )
|
||||||
|
printf("[%s] matched.%d VALID (%s) MoM.%s [%d]\n",ASSETCHAINS_SYMBOL,matched,ccdata.symbol,MoM.ToString().c_str(),MoMdepth);
|
||||||
}
|
}
|
||||||
if ( MoMoMdata.pairs != 0 )
|
if ( MoMoMdata.pairs != 0 )
|
||||||
free(MoMoMdata.pairs);
|
free(MoMoMdata.pairs);
|
||||||
|
|||||||
@@ -476,23 +476,25 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
|
|||||||
UpdateTime(pblock, Params().GetConsensus(), pindexPrev);
|
UpdateTime(pblock, Params().GetConsensus(), pindexPrev);
|
||||||
pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, Params().GetConsensus());
|
pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, Params().GetConsensus());
|
||||||
}
|
}
|
||||||
|
pblock->nSolution.clear();
|
||||||
|
pblocktemplate->vTxSigOps[0] = GetLegacySigOpCount(pblock->vtx[0]);
|
||||||
if ( ASSETCHAINS_SYMBOL[0] == 0 && NOTARY_PUBKEY33[0] != 0 && pblock->nTime < pindexPrev->nTime+60 )
|
if ( ASSETCHAINS_SYMBOL[0] == 0 && NOTARY_PUBKEY33[0] != 0 && pblock->nTime < pindexPrev->nTime+60 )
|
||||||
{
|
{
|
||||||
pblock->nTime = pindexPrev->nTime + 60;
|
pblock->nTime = pindexPrev->nTime + 60;
|
||||||
while ( pblock->GetBlockTime() > GetAdjustedTime() + 10 )
|
//while ( pblock->GetBlockTime() > GetAdjustedTime() + 10 )
|
||||||
sleep(1);
|
// sleep(1);
|
||||||
//fprintf(stderr,"block.nTime %u vs prev.%u, gettime.%u vs adjusted.%u\n",(uint32_t)pblock->nTime,(uint32_t)(pindexPrev->nTime + 60),(uint32_t)pblock->GetBlockTime(),(uint32_t)(GetAdjustedTime() + 60));
|
//fprintf(stderr,"block.nTime %u vs prev.%u, gettime.%u vs adjusted.%u\n",(uint32_t)pblock->nTime,(uint32_t)(pindexPrev->nTime + 60),(uint32_t)pblock->GetBlockTime(),(uint32_t)(GetAdjustedTime() + 60));
|
||||||
}
|
}
|
||||||
pblock->nSolution.clear();
|
else
|
||||||
pblocktemplate->vTxSigOps[0] = GetLegacySigOpCount(pblock->vtx[0]);
|
|
||||||
|
|
||||||
CValidationState state;
|
|
||||||
if ( !TestBlockValidity(state, *pblock, pindexPrev, false, false))
|
|
||||||
{
|
{
|
||||||
//static uint32_t counter;
|
CValidationState state;
|
||||||
//if ( counter++ < 100 && ASSETCHAINS_STAKED == 0 )
|
if ( !TestBlockValidity(state, *pblock, pindexPrev, false, false))
|
||||||
// fprintf(stderr,"warning: miner testblockvalidity failed\n");
|
{
|
||||||
return(0);
|
//static uint32_t counter;
|
||||||
|
//if ( counter++ < 100 && ASSETCHAINS_STAKED == 0 )
|
||||||
|
// fprintf(stderr,"warning: miner testblockvalidity failed\n");
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -788,7 +790,7 @@ void static BitcoinMiner()
|
|||||||
static uint32_t counter;
|
static uint32_t counter;
|
||||||
if ( counter++ < 100 && ASSETCHAINS_STAKED == 0 )
|
if ( counter++ < 100 && ASSETCHAINS_STAKED == 0 )
|
||||||
fprintf(stderr,"created illegal block, retry\n");
|
fprintf(stderr,"created illegal block, retry\n");
|
||||||
sleep(3);
|
sleep(1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
unique_ptr<CBlockTemplate> pblocktemplate(ptr);
|
unique_ptr<CBlockTemplate> pblocktemplate(ptr);
|
||||||
@@ -953,15 +955,6 @@ void static BitcoinMiner()
|
|||||||
for (z=31; z>=16; z--)
|
for (z=31; z>=16; z--)
|
||||||
fprintf(stderr,"%02x",((uint8_t *)&HASHTarget_POW)[z]);
|
fprintf(stderr,"%02x",((uint8_t *)&HASHTarget_POW)[z]);
|
||||||
fprintf(stderr," POW\n");*/
|
fprintf(stderr," POW\n");*/
|
||||||
CValidationState state;
|
|
||||||
if ( !TestBlockValidity(state,B, chainActive.Tip(), true, false))
|
|
||||||
{
|
|
||||||
h = UintToArith256(B.GetHash());
|
|
||||||
for (z=31; z>=0; z--)
|
|
||||||
fprintf(stderr,"%02x",((uint8_t *)&h)[z]);
|
|
||||||
fprintf(stderr," Invalid block mined, try again\n");
|
|
||||||
return(false);
|
|
||||||
}
|
|
||||||
if ( ASSETCHAINS_STAKED == 0 )
|
if ( ASSETCHAINS_STAKED == 0 )
|
||||||
{
|
{
|
||||||
if ( Mining_start != 0 && time(NULL) < Mining_start+roundrobin_delay )
|
if ( Mining_start != 0 && time(NULL) < Mining_start+roundrobin_delay )
|
||||||
@@ -993,6 +986,15 @@ void static BitcoinMiner()
|
|||||||
fprintf(stderr," mined block!\n");
|
fprintf(stderr," mined block!\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
CValidationState state;
|
||||||
|
if ( !TestBlockValidity(state,B, chainActive.Tip(), true, false))
|
||||||
|
{
|
||||||
|
h = UintToArith256(B.GetHash());
|
||||||
|
for (z=31; z>=0; z--)
|
||||||
|
fprintf(stderr,"%02x",((uint8_t *)&h)[z]);
|
||||||
|
fprintf(stderr," Invalid block mined, try again\n");
|
||||||
|
return(false);
|
||||||
|
}
|
||||||
KOMODO_CHOSEN_ONE = 1;
|
KOMODO_CHOSEN_ONE = 1;
|
||||||
// Found a solution
|
// Found a solution
|
||||||
SetThreadPriority(THREAD_PRIORITY_NORMAL);
|
SetThreadPriority(THREAD_PRIORITY_NORMAL);
|
||||||
|
|||||||
Reference in New Issue
Block a user