Test
This commit is contained in:
@@ -864,16 +864,16 @@ int32_t komodo_is_special(uint8_t pubkeys[66][33],int32_t mids[66],uint32_t bloc
|
|||||||
{
|
{
|
||||||
if ( height > 792000 )
|
if ( height > 792000 )
|
||||||
{
|
{
|
||||||
for (j=0; j<66; j++)
|
//for (j=0; j<66; j++)
|
||||||
fprintf(stderr,"%d ",mids[j]);
|
// fprintf(stderr,"%d ",mids[j]);
|
||||||
fprintf(stderr,"ht.%d repeat notaryid.%d in mids[%d]\n",height,notaryid,i);
|
//fprintf(stderr,"ht.%d repeat notaryid.%d in mids[%d]\n",height,notaryid,i);
|
||||||
return(-1);
|
return(-1);
|
||||||
} else break;
|
} else break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( blocktime != 0 && blocktimes[1] != 0 && blocktime < blocktimes[1]+57 )
|
if ( blocktime != 0 && blocktimes[1] != 0 && blocktime < blocktimes[1]+57 )
|
||||||
{
|
{
|
||||||
fprintf(stderr,"lag.%d ht.%d n.%d blocktimes[%u vs %u %u]\n",blocktime-blocktimes[1],height,notaryid,blocktime,blocktimes[0],blocktimes[1]);
|
//fprintf(stderr,"lag.%d ht.%d n.%d blocktimes[%u vs %u %u]\n",blocktime-blocktimes[1],height,notaryid,blocktime,blocktimes[0],blocktimes[1]);
|
||||||
if ( height > 807000 )
|
if ( height > 807000 )
|
||||||
return(-2);
|
return(-2);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,7 +112,6 @@ extern std::string NOTARY_PUBKEY;
|
|||||||
extern uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33];
|
extern uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33];
|
||||||
uint32_t Mining_start,Mining_height;
|
uint32_t Mining_start,Mining_height;
|
||||||
int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp);
|
int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp);
|
||||||
int32_t komodo_is_special(int32_t height,uint8_t pubkey33[33]);
|
|
||||||
int32_t komodo_pax_opreturn(int32_t height,uint8_t *opret,int32_t maxsize);
|
int32_t komodo_pax_opreturn(int32_t height,uint8_t *opret,int32_t maxsize);
|
||||||
uint64_t komodo_paxtotal();
|
uint64_t komodo_paxtotal();
|
||||||
int32_t komodo_baseid(char *origbase);
|
int32_t komodo_baseid(char *origbase);
|
||||||
@@ -213,7 +212,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
|
|||||||
|
|
||||||
if (tx.IsCoinBase() || !IsFinalTx(tx, nHeight, nLockTimeCutoff) || IsExpiredTx(tx, nHeight))
|
if (tx.IsCoinBase() || !IsFinalTx(tx, nHeight, nLockTimeCutoff) || IsExpiredTx(tx, nHeight))
|
||||||
continue;
|
continue;
|
||||||
if ( komodo_validate_interest(tx,nHeight,(uint32_t)pblock->nTime,2) < 0 )
|
if ( komodo_validate_interest(tx,nHeight,(uint32_t)pblock->nTime,0) < 0 )
|
||||||
{
|
{
|
||||||
fprintf(stderr,"CreateNewBlock: komodo_validate_interest failure\n");
|
fprintf(stderr,"CreateNewBlock: komodo_validate_interest failure\n");
|
||||||
continue;
|
continue;
|
||||||
@@ -402,16 +401,16 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
|
|||||||
pblocktemplate->vTxSigOps.push_back(GetLegacySigOpCount(txStaked));
|
pblocktemplate->vTxSigOps.push_back(GetLegacySigOpCount(txStaked));
|
||||||
nFees += txfees;
|
nFees += txfees;
|
||||||
pblock->nTime = blocktime;
|
pblock->nTime = blocktime;
|
||||||
if ( GetAdjustedTime()+30 < pblock->nTime )
|
if ( GetAdjustedTime() < pblock->nTime )
|
||||||
{
|
{
|
||||||
//printf("need to wait %d seconds to submit: ",(int32_t)(pblock->nTime - GetAdjustedTime()));
|
printf("need to wait %d seconds to submit: ",(int32_t)(pblock->nTime - GetAdjustedTime()));
|
||||||
/*while ( GetAdjustedTime()+30 < pblock->nTime )
|
while ( GetAdjustedTime()+30 < pblock->nTime )
|
||||||
{
|
{
|
||||||
sleep(30);
|
sleep(30);
|
||||||
fprintf(stderr,"%d ",(int32_t)(pblock->nTime - GetAdjustedTime()));
|
fprintf(stderr,"%d ",(int32_t)(pblock->nTime - GetAdjustedTime()));
|
||||||
}*/
|
}
|
||||||
//fprintf(stderr,"finished waiting\n");
|
fprintf(stderr,"finished waiting\n");
|
||||||
sleep(30);
|
//sleep(pblock->nTime - GetAdjustedTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
} else fprintf(stderr,"no utxos eligible for staking\n");
|
} else fprintf(stderr,"no utxos eligible for staking\n");
|
||||||
@@ -485,6 +484,8 @@ 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());
|
||||||
}
|
}
|
||||||
|
if ( ASSETCHAINS_SYMBOL[0] == 0 && NOTARY_PUBKEY33[0] != 0 && pblock->nTime < pindexPrev->nTime+60 )
|
||||||
|
pblock->nTime = pindexPrev->nTime + 60;
|
||||||
pblock->nSolution.clear();
|
pblock->nSolution.clear();
|
||||||
pblocktemplate->vTxSigOps[0] = GetLegacySigOpCount(pblock->vtx[0]);
|
pblocktemplate->vTxSigOps[0] = GetLegacySigOpCount(pblock->vtx[0]);
|
||||||
|
|
||||||
@@ -658,7 +659,7 @@ static bool ProcessBlockFound(CBlock* pblock)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t komodo_baseid(char *origbase);
|
int32_t komodo_baseid(char *origbase);
|
||||||
int32_t komodo_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,uint32_t blocktimes[66],int32_t *nonzpkeysp,int32_t height);
|
int32_t komodo_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,uint32_t *blocktimes,int32_t *nonzpkeysp,int32_t height);
|
||||||
arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t height,int32_t goalperc);
|
arith_uint256 komodo_PoWtarget(int32_t *percPoSp,arith_uint256 target,int32_t height,int32_t goalperc);
|
||||||
int32_t FOUND_BLOCK,KOMODO_MAYBEMINED;
|
int32_t FOUND_BLOCK,KOMODO_MAYBEMINED;
|
||||||
extern int32_t KOMODO_LASTMINED;
|
extern int32_t KOMODO_LASTMINED;
|
||||||
@@ -693,7 +694,6 @@ void static BitcoinMiner()
|
|||||||
if ( komodo_baseid(ASSETCHAINS_SYMBOL) < 0 )
|
if ( komodo_baseid(ASSETCHAINS_SYMBOL) < 0 )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//sleep(60);
|
|
||||||
komodo_chosennotary(¬aryid,chainActive.Tip()->nHeight,NOTARY_PUBKEY33,(uint32_t)chainActive.Tip()->GetBlockTime());
|
komodo_chosennotary(¬aryid,chainActive.Tip()->nHeight,NOTARY_PUBKEY33,(uint32_t)chainActive.Tip()->GetBlockTime());
|
||||||
|
|
||||||
std::string solver;
|
std::string solver;
|
||||||
@@ -918,12 +918,14 @@ void static BitcoinMiner()
|
|||||||
// fprintf(stderr," missed target\n");
|
// fprintf(stderr," missed target\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
CValidationState tmpstate;
|
CValidationState state;
|
||||||
if ( !TestBlockValidity(tmpstate, *pblock, chainActive.Tip(), true, false))
|
if ( !TestBlockValidity(state, *pblock, chainActive.Tip(), true, false))
|
||||||
{
|
{
|
||||||
fprintf(stderr,"formerly valid mining block became invalid\n");
|
fprintf(stderr,"Invalid block mined, try again\n");
|
||||||
return false;
|
return(false);
|
||||||
}
|
}
|
||||||
|
if ( ASSETCHAINS_STAKED == 0 )
|
||||||
|
{
|
||||||
if ( Mining_start != 0 && time(NULL) < Mining_start+roundrobin_delay )
|
if ( Mining_start != 0 && time(NULL) < Mining_start+roundrobin_delay )
|
||||||
{
|
{
|
||||||
//printf("Round robin diff sleep %d\n",(int32_t)(Mining_start+roundrobin_delay-time(NULL)));
|
//printf("Round robin diff sleep %d\n",(int32_t)(Mining_start+roundrobin_delay-time(NULL)));
|
||||||
@@ -936,6 +938,23 @@ void static BitcoinMiner()
|
|||||||
{
|
{
|
||||||
sleep(rand() % 30);
|
sleep(rand() % 30);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( NOTARY_PUBKEY33[0] != 0 )
|
||||||
|
{
|
||||||
|
printf("need to wait %d seconds to submit\n",(int32_t)(pblock->nTime - GetAdjustedTime()));
|
||||||
|
while ( GetAdjustedTime() < pblock->nTime )
|
||||||
|
sleep(1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
uint256 tmp = pblock->GetHash();
|
||||||
|
int32_t z; for (z=31; z>=0; z--)
|
||||||
|
fprintf(stderr,"%02x",((uint8_t *)&tmp)[z]);
|
||||||
|
fprintf(stderr," mined block!\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
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