Browse Source

Merge branch 'master' into release/v0.1

release/v0.1
jl777 9 years ago
parent
commit
bd68faed7b
  1. 26
      iguana/iguana777.c
  2. 6
      iguana/iguana_bundles.c
  3. 2
      iguana/iguana_recv.c
  4. 12
      iguana/iguana_spendvectors.c
  5. 2
      includes/iguana_defines.h

26
iguana/iguana777.c

@ -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++)

6
iguana/iguana_bundles.c

@ -1364,12 +1364,14 @@ void iguana_bundlestats(struct supernet_info *myinfo,struct iguana_info *coin,ch
numcached += bp->numcached; numcached += bp->numcached;
numrecv += bp->numrecv; numrecv += bp->numrecv;
numsaved += bp->numsaved; numsaved += bp->numsaved;
if ( bp->emitfinish > 1 ) if ( bp->utxofinish > 1 )
numutxo++; numutxo++;
if ( bp->balancefinish > 1 ) if ( bp->balancefinish > 1 )
numbalances++; numbalances++;
if ( bp->validated > 1 ) if ( bp->validated > 1 )
numv++; numv++;
if ( bp->emitfinish == 0 && bp->ramchain.H.data != 0 )
bp->emitfinish = (uint32_t)time(NULL);
if ( bp->emitfinish >= 1 ) if ( bp->emitfinish >= 1 )
{ {
if ( bp->emitfinish == 1 ) if ( bp->emitfinish == 1 )
@ -1517,7 +1519,7 @@ void iguana_bundlestats(struct supernet_info *myinfo,struct iguana_info *coin,ch
{ {
//printf("bundleQ.[%d]\n",j); //printf("bundleQ.[%d]\n",j);
bp->balancefinish = bp->startutxo = 0; bp->balancefinish = bp->startutxo = 0;
bp->emitfinish = 1; bp->utxofinish = 1;
iguana_bundleQ(myinfo,coin,bp,1000); iguana_bundleQ(myinfo,coin,bp,1000);
} }
} }

2
iguana/iguana_recv.c

@ -2038,7 +2038,7 @@ int32_t iguana_blockQ(char *argstr,struct iguana_info *coin,struct iguana_bundle
//getchar(); //getchar();
return(-1); return(-1);
} }
if ( 1 && coin->enableCACHE != 0 && iguana_speculativesearch(coin,&block,hash2) != 0 && block != 0 && block->txvalid != 0 ) if ( 0 && coin->enableCACHE != 0 && iguana_speculativesearch(coin,&block,hash2) != 0 && block != 0 && block->txvalid != 0 )
{ {
//printf("found valid [%d:%d] in blockQ\n",block!=0?block->hdrsi:-1,block!=0?block->bundlei:-1); //printf("found valid [%d:%d] in blockQ\n",block!=0?block->hdrsi:-1,block!=0?block->bundlei:-1);
return(0); return(0);

12
iguana/iguana_spendvectors.c

@ -84,7 +84,7 @@ int32_t iguana_spendvectorsave(struct iguana_info *coin,struct iguana_bundle *bp
printf("error mapping Xspendmap.(%s)\n",fname); printf("error mapping Xspendmap.(%s)\n",fname);
else else
{ {
printf("created.(%s) %p[%d]\n",fname,bp->ramchain.Xspendinds,bp->ramchain.numXspends); //printf("created.(%s) %p[%d]\n",fname,bp->ramchain.Xspendinds,bp->ramchain.numXspends);
retval = 0; retval = 0;
} }
} }
@ -261,7 +261,7 @@ int32_t iguana_spendvectors(struct supernet_info *myinfo,struct iguana_info *coi
{ {
bp->tmpspends = ramchain->Xspendinds; bp->tmpspends = ramchain->Xspendinds;
bp->numtmpspends = ramchain->numXspends; bp->numtmpspends = ramchain->numXspends;
bp->emitfinish = (uint32_t)time(NULL); bp->utxofinish = (uint32_t)time(NULL);
bp->balancefinish = 0; bp->balancefinish = 0;
//printf("iguana_spendvectors.[%d]: already have Xspendinds[%d]\n",bp->hdrsi,ramchain->numXspends); //printf("iguana_spendvectors.[%d]: already have Xspendinds[%d]\n",bp->hdrsi,ramchain->numXspends);
return(0); return(0);
@ -341,7 +341,7 @@ int32_t iguana_spendvectors(struct supernet_info *myinfo,struct iguana_info *coi
{ {
if ( coin->PREFETCHLAG > 0 && now >= spentbp->lastprefetch+coin->PREFETCHLAG ) if ( coin->PREFETCHLAG > 0 && now >= spentbp->lastprefetch+coin->PREFETCHLAG )
{ {
printf("prefetch[%d] from.[%d] lag.%d\n",spentbp->hdrsi,bp->hdrsi,now - spentbp->lastprefetch); //printf("prefetch[%d] from.[%d] lag.%d\n",spentbp->hdrsi,bp->hdrsi,now - spentbp->lastprefetch);
iguana_ramchain_prefetch(coin,&spentbp->ramchain,2); iguana_ramchain_prefetch(coin,&spentbp->ramchain,2);
spentbp->lastprefetch = now; spentbp->lastprefetch = now;
} }
@ -622,7 +622,7 @@ int32_t iguana_volatilesinit(struct supernet_info *myinfo,struct iguana_info *co
{ {
if ( (bp= coin->bundles[i]) == 0 ) if ( (bp= coin->bundles[i]) == 0 )
continue; continue;
if ( bp->emitfinish <= 1 || (i > 0 && bp->utxofinish <= 1) ) if ( bp->utxofinish <= 1 || (i > 0 && bp->utxofinish <= 1) )
{ {
//printf("hdrsi.[%d] emitfinish.%u utxofinish.%u\n",i,bp->emitfinish,bp->utxofinish); //printf("hdrsi.[%d] emitfinish.%u utxofinish.%u\n",i,bp->emitfinish,bp->utxofinish);
continue; continue;
@ -751,7 +751,7 @@ void iguana_initfinal(struct supernet_info *myinfo,struct iguana_info *coin,bits
} }
for (i=0; i<coin->bundlescount-1; i++) for (i=0; i<coin->bundlescount-1; i++)
{ {
if ( (bp= coin->bundles[i]) == 0 || bp->emitfinish <= 1 ) if ( (bp= coin->bundles[i]) == 0 || bp->utxofinish <= 1 )
{ {
printf("%s initfinal break.[%d]: bp.%p or emit.%u utxofinish.%u\n",coin->symbol,i,bp,bp!=0?bp->emitfinish:-1,bp!=0?bp->utxofinish:-1); printf("%s initfinal break.[%d]: bp.%p or emit.%u utxofinish.%u\n",coin->symbol,i,bp,bp!=0?bp->emitfinish:-1,bp!=0?bp->utxofinish:-1);
break; break;
@ -1160,7 +1160,7 @@ int32_t iguana_bundlevalidate(struct supernet_info *myinfo,struct iguana_info *c
printf("%s %s VALIDATED.[%d] ht.%d duration.%d errs.%d total.%lld %u | total errs.%d validated.%d %llx\n",coin->symbol,errs!=0?"NOT":"",bp->hdrsi,bp->bundleheight,(uint32_t)time(NULL) - now,errs,(long long)total,bp->validated,totalerrs,totalvalidated,(long long)validatehash.txid); printf("%s %s VALIDATED.[%d] ht.%d duration.%d errs.%d total.%lld %u | total errs.%d validated.%d %llx\n",coin->symbol,errs!=0?"NOT":"",bp->hdrsi,bp->bundleheight,(uint32_t)time(NULL) - now,errs,(long long)total,bp->validated,totalerrs,totalvalidated,(long long)validatehash.txid);
if ( errs == 0 ) if ( errs == 0 )
bp->validated = (uint32_t)time(NULL); bp->validated = (uint32_t)time(NULL);
else bp->startutxo = bp->utxofinish = 0; else bp->validated = bp->startutxo = bp->utxofinish = 0;
//iguana_volatilesmap(coin,&bp->ramchain); //iguana_volatilesmap(coin,&bp->ramchain);
//if ( bp == coin->current ) //if ( bp == coin->current )
// coin->RTdatabad = -1; // coin->RTdatabad = -1;

2
includes/iguana_defines.h

@ -25,7 +25,7 @@
#ifdef __PNACL__ #ifdef __PNACL__
#define IGUANA_MAXITERATIONS 77 #define IGUANA_MAXITERATIONS 77
#else #else
#define IGUANA_MAXITERATIONS 77 #define IGUANA_MAXITERATIONS 777
#endif #endif
#define IGUANA_DEFAULTLAG 7 #define IGUANA_DEFAULTLAG 7

Loading…
Cancel
Save