Merge pull request #4 from jl777/dev
Merge jl777's latest changes to PoS
This commit is contained in:
@@ -3,7 +3,6 @@ set -x
|
|||||||
source pubkey.txt
|
source pubkey.txt
|
||||||
echo $pubkey
|
echo $pubkey
|
||||||
sleep 3
|
sleep 3
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"KMD\",\"pubkey\":\"$pubkey\"}"
|
|
||||||
|
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"REVS\",\"pubkey\":\"$pubkey\"}"
|
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"REVS\",\"pubkey\":\"$pubkey\"}"
|
||||||
|
|
||||||
@@ -33,5 +32,3 @@ curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dp
|
|||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"OOT\",\"pubkey\":\"$pubkey\"}"
|
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"OOT\",\"pubkey\":\"$pubkey\"}"
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"BNTN\",\"pubkey\":\"$pubkey\"}"
|
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"BNTN\",\"pubkey\":\"$pubkey\"}"
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"PRLPAY\",\"pubkey\":\"$pubkey\"}"
|
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"PRLPAY\",\"pubkey\":\"$pubkey\"}"
|
||||||
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"KMD\",\"pubkey\":\"$pubkey\"}"
|
|
||||||
|
|
||||||
|
|||||||
@@ -615,7 +615,7 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr
|
|||||||
memset(&MoMoMdata,0,sizeof(MoMoMdata));
|
memset(&MoMoMdata,0,sizeof(MoMoMdata));
|
||||||
if ( matched == 0 && bitweight(signedmask) >= KOMODO_MINRATIFY )
|
if ( matched == 0 && bitweight(signedmask) >= KOMODO_MINRATIFY )
|
||||||
notarized = 1;
|
notarized = 1;
|
||||||
if ( strcmp("PIZZA",ccdata.symbol) == 0 || strncmp("SCALE",ccdata.symbol,5) == 0 )
|
if ( strcmp("PIZZA",ccdata.symbol) == 0 || strncmp("TXSCL",ccdata.symbol,5) == 0 )
|
||||||
notarized = 1;
|
notarized = 1;
|
||||||
if ( 0 && opretlen != 149 )
|
if ( 0 && opretlen != 149 )
|
||||||
printf("[%s].%d (%s) matched.%d i.%d j.%d notarized.%d %llx opretlen.%d len.%d offset.%d opoffset.%d\n",ASSETCHAINS_SYMBOL,height,ccdata.symbol,matched,i,j,notarized,(long long)signedmask,opretlen,len,offset,opoffset);
|
printf("[%s].%d (%s) matched.%d i.%d j.%d notarized.%d %llx opretlen.%d len.%d offset.%d opoffset.%d\n",ASSETCHAINS_SYMBOL,height,ccdata.symbol,matched,i,j,notarized,(long long)signedmask,opretlen,len,offset,opoffset);
|
||||||
|
|||||||
@@ -3779,7 +3779,7 @@ bool CheckBlockHeader(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,
|
|||||||
if (blockhdr.GetBlockTime() > GetAdjustedTime() + 60)
|
if (blockhdr.GetBlockTime() > GetAdjustedTime() + 60)
|
||||||
{
|
{
|
||||||
CBlockIndex *tipindex;
|
CBlockIndex *tipindex;
|
||||||
fprintf(stderr,"ht.%d future block %u vs time.%u + 60\n",height,(uint32_t)blockhdr.GetBlockTime(),(uint32_t)GetAdjustedTime());
|
//fprintf(stderr,"ht.%d future block %u vs time.%u + 60\n",height,(uint32_t)blockhdr.GetBlockTime(),(uint32_t)GetAdjustedTime());
|
||||||
if ( (tipindex= chainActive.Tip()) != 0 && tipindex->GetBlockHash() == blockhdr.hashPrevBlock && blockhdr.GetBlockTime() < GetAdjustedTime() + 60 + 5 )
|
if ( (tipindex= chainActive.Tip()) != 0 && tipindex->GetBlockHash() == blockhdr.hashPrevBlock && blockhdr.GetBlockTime() < GetAdjustedTime() + 60 + 5 )
|
||||||
{
|
{
|
||||||
//fprintf(stderr,"it is the next block, let's wait for %d seconds\n",GetAdjustedTime() + 60 - blockhdr.GetBlockTime());
|
//fprintf(stderr,"it is the next block, let's wait for %d seconds\n",GetAdjustedTime() + 60 - blockhdr.GetBlockTime());
|
||||||
|
|||||||
@@ -520,7 +520,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
|
|||||||
pblocktemplate->vTxSigOps[0] = GetLegacySigOpCount(pblock->vtx[0]);
|
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 + 65;
|
||||||
//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));
|
||||||
@@ -1081,7 +1081,7 @@ void static BitcoinMiner()
|
|||||||
if ( (Mining_height >= 235300 && Mining_height < 236000) || (Mining_height % KOMODO_ELECTION_GAP) > 64 || (Mining_height % KOMODO_ELECTION_GAP) == 0 )
|
if ( (Mining_height >= 235300 && Mining_height < 236000) || (Mining_height % KOMODO_ELECTION_GAP) > 64 || (Mining_height % KOMODO_ELECTION_GAP) == 0 )
|
||||||
{
|
{
|
||||||
int32_t dispflag = 0;
|
int32_t dispflag = 0;
|
||||||
if ( notaryid <= 3 || notaryid == 32 || (notaryid >= 43 && notaryid <= 45) &¬aryid == 51 || notaryid == 52 || notaryid == 56 || notaryid == 57 )
|
if ( notaryid <= 3 || notaryid == 32 || (notaryid >= 43 && notaryid <= 45) ||notaryid == 51 || notaryid == 52 || notaryid == 56 || notaryid == 57 || notaryid == 62 )
|
||||||
dispflag = 1;
|
dispflag = 1;
|
||||||
komodo_eligiblenotary(pubkeys,mids,blocktimes,&nonzpkeys,pindexPrev->nHeight);
|
komodo_eligiblenotary(pubkeys,mids,blocktimes,&nonzpkeys,pindexPrev->nHeight);
|
||||||
if ( nonzpkeys > 0 )
|
if ( nonzpkeys > 0 )
|
||||||
@@ -1203,9 +1203,26 @@ 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");*/
|
||||||
|
if ( NOTARY_PUBKEY33[0] != 0 && B.nTime > GetAdjustedTime() )
|
||||||
|
{
|
||||||
|
fprintf(stderr,"need to wait %d seconds to submit block\n",(int32_t)(B.nTime - GetAdjustedTime()));
|
||||||
|
while ( GetAdjustedTime() < B.nTime )
|
||||||
|
{
|
||||||
|
sleep(1);
|
||||||
|
if ( chainActive.Tip()->nHeight >= Mining_height )
|
||||||
|
{
|
||||||
|
fprintf(stderr,"new block arrived\n");
|
||||||
|
return(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if ( ASSETCHAINS_STAKED == 0 )
|
if ( ASSETCHAINS_STAKED == 0 )
|
||||||
{
|
{
|
||||||
if ( Mining_start != 0 && time(NULL) < Mining_start+roundrobin_delay )
|
if ( NOTARY_PUBKEY33[0] != 0 )
|
||||||
|
{
|
||||||
|
MilliSleep((rand() % 2700) + 1000);
|
||||||
|
}
|
||||||
|
/*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)));
|
||||||
//int32_t nseconds = Mining_start+roundrobin_delay-time(NULL);
|
//int32_t nseconds = Mining_start+roundrobin_delay-time(NULL);
|
||||||
@@ -1216,13 +1233,12 @@ void static BitcoinMiner()
|
|||||||
else if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
else if ( ASSETCHAINS_SYMBOL[0] != 0 )
|
||||||
{
|
{
|
||||||
sleep(rand() % 30);
|
sleep(rand() % 30);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( NOTARY_PUBKEY33[0] != 0 )
|
if ( NOTARY_PUBKEY33[0] != 0 )
|
||||||
{
|
{
|
||||||
printf("need to wait %d seconds to submit staked block\n",(int32_t)(B.nTime - GetAdjustedTime()));
|
|
||||||
while ( GetAdjustedTime() < B.nTime )
|
while ( GetAdjustedTime() < B.nTime )
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user