Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
44b45a52a3
  1. 11
      iguana/iguana777.c
  2. 33
      iguana/iguana_ramchain.c
  3. 7
      iguana/iguana_unspents.c

11
iguana/iguana777.c

@ -361,7 +361,7 @@ int32_t iguana_utxogen(struct iguana_info *coin,int32_t helperid,int32_t convert
{
int32_t hdrsi,retval,n,max,incr,num = 0; struct iguana_bundle *bp;
incr = IGUANA_NUMHELPERS;
if ( 1 && coin->PREFETCHLAG > 0 )
if ( 0 && coin->PREFETCHLAG > 0 )
{
incr = 1;
if ( incr < 1 )
@ -378,7 +378,7 @@ int32_t iguana_utxogen(struct iguana_info *coin,int32_t helperid,int32_t convert
return(-1);
if ( coin->PREFETCHLAG > 0 )
iguana_ramchain_prefetch(coin,&bp->ramchain,0);
if ( iguana_bundlevalidate(coin,bp,0) == bp->n )
//if ( iguana_bundlevalidate(coin,bp,0) == bp->n )
{
if ( (retval= iguana_spendvectors(coin,bp,&bp->ramchain,0,bp->n,convertflag)) >= 0 )
{
@ -391,7 +391,12 @@ int32_t iguana_utxogen(struct iguana_info *coin,int32_t helperid,int32_t convert
bp->utxofinish = (uint32_t)time(NULL);
} else printf("UTXO gen.[%d] utxo error\n",bp->hdrsi);
}
else
}
for (hdrsi=helperid; hdrsi<max; hdrsi+=incr)
{
if ( (bp= coin->bundles[hdrsi]) == 0 )
return(-1);
if ( iguana_bundlevalidate(coin,bp,0) != bp->n )
{
printf("validate.[%d] error. just refresh page or restart iguana\n",bp->hdrsi);
exit(-1);

33
iguana/iguana_ramchain.c

@ -629,8 +629,7 @@ void *_iguana_ramchain_setptrs(RAMCHAIN_PTRPS,struct iguana_ramchaindata *rdata)
void *iguana_ramchain_offset(char *fname,void *dest,uint8_t *lhash,FILE *fp,uint64_t fpos,void *srcptr,uint64_t *offsetp,uint64_t len,uint64_t srcsize)
{
long err,startfpos;
void *destptr = (void *)(long)((long)dest + *offsetp);
long err,startfpos; void *destptr = (void *)(long)((long)dest + *offsetp);
if ( (lhash != 0 || fp != 0) && (*offsetp + len) > srcsize )
{
printf("ramchain_offset overflow (%p %p) offset.%ld + len.%ld %ld > %ld srcsize\n",fp,lhash,(long)*offsetp,(long)len,(long)(*offsetp + len),(long)srcsize);
@ -646,15 +645,27 @@ void *iguana_ramchain_offset(char *fname,void *dest,uint8_t *lhash,FILE *fp,uint
startfpos = ftell(fp);
if ( (err= fwrite(srcptr,1,len,fp)) != len )
{
printf("iguana_ramchain_offset.(%s): error.%ld writing len.%ld to fp.%p errno.%d\n",fname,err,(long)len,fp,errno);
printf("probably out of disk space. please free up space\n");
fprintf(stderr,"iguana_ramchain_sizefunc.(%s): error.%ld writing len.%ld to fp.%p errno.%d\n",fname,err,(long)len,fp,errno);
fprintf(stderr,"probably out of disk space. please free up space\n");
sleep(1);
fseek(fp,startfpos,SEEK_SET);
if ( (err= fwrite(srcptr,1,len,fp)) == len )
printf("second write worked!\n");
else fpos = len = 0;
#ifdef __PNACL__
int32_t i,numretries = 5;
for (i=0; i<numretries; i++)
{
sleep(i + 1);
fseek(fp,startfpos,SEEK_SET);
if ( (err= fwrite(srcptr,1,len,fp)) == len )
{
printf("write.%d of %d worked!\n",i,numretries);
break;
}
}
if ( i == numretries )
#endif
{
fpos = len = 0;
printf("iguana_ramchain_offset.(%s): error.%ld writing len.%ld to fp.%p errno.%d\n",fname,err,(long)len,fp,errno);
printf("probably out of disk space. please free up space\n");
fprintf(stderr,"iguana_ramchain_sizefunc.(%s): error.%ld writing len.%ld to fp.%p errno.%d\n",fname,err,(long)len,fp,errno);
fprintf(stderr,"probably out of disk space. please free up space\n");
}
}
//else printf("fp.(%ld <- %d) ",ftell(fp),(int32_t)len);
}

7
iguana/iguana_unspents.c

@ -307,10 +307,11 @@ int32_t iguana_volatileupdate(struct iguana_info *coin,int32_t incremental,struc
}
}
printf("iguana_volatileupdate.%d: [%d] spent.(u%u %.8f pkind.%d) double spend? at ht.%d [%d] spendind.%d\n",incremental,spent_hdrsi,spent_unspentind,dstr(spent_value),spent_pkind,fromheight,fromheight/coin->chain->bundlesize,spendind);
if ( coin->current != 0 && coin->current->hdrsi == fromheight/coin->chain->bundlesize )
if ( coin->current != 0 && fromheight >= coin->current->bundleheight )
coin->RTdatabad = 1;
else
{
printf("from.%d vs current.%d\n",fromheight,coin->current->bundleheight);
iguana_bundleremove(coin,spent_hdrsi,0);
iguana_bundleremove(coin,fromheight/coin->chain->bundlesize,0);
}
@ -1780,6 +1781,8 @@ void iguana_RThdrs(struct iguana_info *coin,struct iguana_bundle *bp,int32_t num
void iguana_RTspendvectors(struct iguana_info *coin,struct iguana_bundle *bp)
{
int32_t lasti,hdrsi,orignumemit; struct iguana_ramchain R; struct iguana_ramchaindata RDATA;
if ( bp->hdrsi <= 0 )
return;
bp->ramchain = coin->RTramchain;
iguana_rdataset(&R,&RDATA,&coin->RTramchain);
if ( (lasti= (coin->RTheight - ((coin->RTheight/bp->n)*bp->n))) >= bp->n-1 )
@ -1799,7 +1802,7 @@ void iguana_RTspendvectors(struct iguana_info *coin,struct iguana_bundle *bp)
iguana_convert(coin,IGUANA_NUMHELPERS,coin->bundles[hdrsi],1,orignumemit);
//printf("spendvectors converted to %d\n",coin->RTheight);
bp->converted = (uint32_t)time(NULL);
iguana_balancegen(coin,0,bp,coin->RTstarti,coin->RTheight-1,orignumemit);
iguana_balancegen(coin,0,bp,coin->RTstarti,coin->RTheight > 0 ? coin->RTheight-1 : bp->n-1,orignumemit);
//printf("iguana_balancegen [%d] (%d to %d)\n",bp->hdrsi,coin->RTstarti,(coin->RTheight-1)%bp->n);
coin->RTstarti = (coin->RTheight % bp->n);
}

Loading…
Cancel
Save