From 44b45a52a3e89967e645562fa671477de268c6fb Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 17 Apr 2016 17:06:19 -0500 Subject: [PATCH] test --- iguana/iguana777.c | 11 ++++++++--- iguana/iguana_ramchain.c | 33 ++++++++++++++++++++++----------- iguana/iguana_unspents.c | 7 +++++-- 3 files changed, 35 insertions(+), 16 deletions(-) diff --git a/iguana/iguana777.c b/iguana/iguana777.c index 2e107c8c8..c63d8db12 100755 --- a/iguana/iguana777.c +++ b/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; hdrsibundles[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); diff --git a/iguana/iguana_ramchain.c b/iguana/iguana_ramchain.c index 65081b1cf..61bf1b34b 100755 --- a/iguana/iguana_ramchain.c +++ b/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; ichain->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); }