|
@ -326,12 +326,16 @@ int32_t iguana_emitfinished(struct supernet_info *myinfo,struct iguana_info *coi |
|
|
{ |
|
|
{ |
|
|
if ( (bp= coin->bundles[i]) != 0 ) |
|
|
if ( (bp= coin->bundles[i]) != 0 ) |
|
|
{ |
|
|
{ |
|
|
|
|
|
if ( bp->emitfinish == 0 && bp->ramchain.H.data != 0 ) |
|
|
|
|
|
bp->emitfinish = (uint32_t)time(NULL); |
|
|
if ( bp->emitfinish > 1 ) |
|
|
if ( bp->emitfinish > 1 ) |
|
|
n++; |
|
|
n++; |
|
|
|
|
|
//printf("%u ",bp->emitfinish);
|
|
|
//else if ( bp->emitfinish == 0 && bp->queued == 0 )
|
|
|
//else if ( bp->emitfinish == 0 && bp->queued == 0 )
|
|
|
// iguana_bundleQ(myinfo,coin,bp,1000);
|
|
|
// iguana_bundleQ(myinfo,coin,bp,1000);
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
//printf("emitfinished.%d\n",n);
|
|
|
return(n); |
|
|
return(n); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -661,7 +665,7 @@ int32_t iguana_coin_mainiter(struct supernet_info *myinfo,struct iguana_info *co |
|
|
void iguana_helper(void *arg) |
|
|
void iguana_helper(void *arg) |
|
|
{ |
|
|
{ |
|
|
static uint64_t helperidbits; |
|
|
static uint64_t helperidbits; |
|
|
cJSON *argjson=0; int32_t iter,n,i,j,numpeers,polltimeout,type,helperid=rand(),flag,allcurrent,idle=0; |
|
|
cJSON *argjson=0; int32_t iter,n,i,j,retval,numpeers,polltimeout,type,helperid=rand(),flag,allcurrent,idle=0; |
|
|
struct iguana_helper *ptr; struct iguana_info *coin,*tmp; struct OS_memspace MEM,*MEMB; struct iguana_bundle *bp; struct supernet_info *myinfo = SuperNET_MYINFO(0); |
|
|
struct iguana_helper *ptr; struct iguana_info *coin,*tmp; struct OS_memspace MEM,*MEMB; struct iguana_bundle *bp; struct supernet_info *myinfo = SuperNET_MYINFO(0); |
|
|
helperid %= 64; |
|
|
helperid %= 64; |
|
|
if ( arg != 0 && (argjson= cJSON_Parse(arg)) != 0 ) |
|
|
if ( arg != 0 && (argjson= cJSON_Parse(arg)) != 0 ) |
|
@ -712,7 +716,7 @@ void iguana_helper(void *arg) |
|
|
{ |
|
|
{ |
|
|
if ( bp->emitfinish == 0 && bp->numsaved >= coin->chain->bundlesize && iguana_bundleready(myinfo,coin,bp,0) == bp->n ) |
|
|
if ( bp->emitfinish == 0 && bp->numsaved >= coin->chain->bundlesize && iguana_bundleready(myinfo,coin,bp,0) == bp->n ) |
|
|
iguana_bundlefinalize(myinfo,coin,bp,&MEM,MEMB); |
|
|
iguana_bundlefinalize(myinfo,coin,bp,&MEM,MEMB); |
|
|
if ( 0 && bp->emitfinish != 0 && time(NULL) > bp->emitfinish+60 ) |
|
|
if ( bp->emitfinish != 0 && time(NULL) > bp->emitfinish+60 ) |
|
|
{ |
|
|
{ |
|
|
if ( bp->validated == 0 ) |
|
|
if ( bp->validated == 0 ) |
|
|
{ |
|
|
{ |
|
@ -720,7 +724,22 @@ void iguana_helper(void *arg) |
|
|
if ( coin->bundles[i] == 0 || coin->bundles[i]->validated <= 1 ) |
|
|
if ( coin->bundles[i] == 0 || coin->bundles[i]->validated <= 1 ) |
|
|
break; |
|
|
break; |
|
|
if ( i == j ) |
|
|
if ( i == j ) |
|
|
iguana_bundlevalidate(myinfo,coin,bp,1); |
|
|
{ |
|
|
|
|
|
iguana_bundlevalidate(myinfo,coin,bp,0); |
|
|
|
|
|
if ( bp->validated > 1 ) |
|
|
|
|
|
{ |
|
|
|
|
|
for (i=0; i<j; i++) |
|
|
|
|
|
if ( coin->bundles[i] == 0 || coin->bundles[i]->utxofinish <= 1 ) |
|
|
|
|
|
break; |
|
|
|
|
|
if ( bp->utxofinish == 0 || (retval= iguana_spendvectors(myinfo,coin,bp,&bp->ramchain,0,bp->n,1,0)) >= 0 ) |
|
|
|
|
|
{ |
|
|
|
|
|
if ( retval > 0 ) |
|
|
|
|
|
{ |
|
|
|
|
|
printf("GENERATED UTXO.%d for ht.%d duration %d seconds\n",bp->hdrsi,bp->bundleheight,(uint32_t)time(NULL) - bp->startutxo); |
|
|
|
|
|
bp->utxofinish = (uint32_t)time(NULL); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -730,6 +749,7 @@ void iguana_helper(void *arg) |
|
|
if ( helperid == 0 ) |
|
|
if ( helperid == 0 ) |
|
|
iguana_coin_mainiter(myinfo,coin,&numpeers,&MEM,MEMB); |
|
|
iguana_coin_mainiter(myinfo,coin,&numpeers,&MEM,MEMB); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
//portable_mutex_unlock(&myinfo->allcoins_mutex);
|
|
|
//portable_mutex_unlock(&myinfo->allcoins_mutex);
|
|
|
n = queue_size(&bundlesQ); |
|
|
n = queue_size(&bundlesQ); |
|
|
for (iter=0; iter<n; iter++) |
|
|
for (iter=0; iter<n; iter++) |
|
|