diff --git a/iguana/iguana_ramchain.c b/iguana/iguana_ramchain.c index d1a20bc71..b53365cf9 100755 --- a/iguana/iguana_ramchain.c +++ b/iguana/iguana_ramchain.c @@ -2136,7 +2136,7 @@ int32_t iguana_bundlesaveHT(struct iguana_info *coin,struct OS_memspace *mem,str static int depth; static bits256 zero; RAMCHAIN_DESTDECLARE; RAMCHAIN_DECLARE; void **ptrs,*ptr; long *filesizes,filesize; uint32_t *ipbits; char fname[1024]; - struct iguana_ramchain *R,*mapchain,*dest,newchain; uint32_t fpipbits,now = (uint32_t)time(NULL); + struct iguana_ramchain *R,*mapchain,*dest,newchain; uint32_t fpipbits; int32_t i,numtxids,valid,sigspace,pubkeyspace,numunspents,numspends,numpkinds,numexternaltxids,scriptspace,fpos; struct iguana_block *block; struct OS_memspace HASHMEM; int32_t err,j,num,hdrsi,bundlei,firsti= 1,retval = -1; //if ( bp->bundleheight == 166000 || bp->bundleheight == 316000 || bp->bundleheight == 142000 || bp->bundleheight == 306000 || bp->bundleheight == 128000 || bp->bundleheight == 254000 || bp->bundleheight == 190000 || bp->bundleheight == 118000 || bp->bundleheight == 62000 || bp->bundleheight == 148000 ) @@ -2306,7 +2306,7 @@ int32_t iguana_bundlesaveHT(struct iguana_info *coin,struct OS_memspace *mem,str memset(&newchain,0,sizeof(newchain)); if ( bundlei == bp->n && iguana_ramchain_expandedsave(coin,RAMCHAIN_DESTARG,&newchain,&HASHMEM,0,bp) == 0 ) { - char str[65]; printf("d.%d ht.%d %s saved lag.%d elapsed.%ld\n",depth,dest->height,mbstr(str,dest->H.data->allocsize),now-starttime,time(NULL)-now); + //char str[65]; printf("d.%d ht.%d %s saved lag.%d elapsed.%ld\n",depth,dest->height,mbstr(str,dest->H.data->allocsize),now-starttime,time(NULL)-now); retval = 0; } else bp->generrs++; iguana_bundlemapfree(mem,&HASHMEM,ipbits,ptrs,filesizes,num,R,bp->n); diff --git a/iguana/iguana_recv.c b/iguana/iguana_recv.c index 553b77ba9..c1a9b6e4c 100755 --- a/iguana/iguana_recv.c +++ b/iguana/iguana_recv.c @@ -498,7 +498,7 @@ int32_t iguana_bundleiters(struct iguana_info *coin,struct iguana_bundle *bp,int { printf("GENERATED UTXO for ht.%d duration %d seconds\n",bp->bundleheight,(uint32_t)time(NULL)-bp->startutxo); bp->utxofinish = (uint32_t)time(NULL); - } else printf("UTXO write error\n"); + } else printf("UTXO gen error\n"); } if ( bp->utxofinish != 0 && bp->balancefinish == 0 && (bp->hdrsi == 0 || (prevbp != 0 && prevbp->utxofinish != 0)) ) { diff --git a/iguana/iguana_unspents.c b/iguana/iguana_unspents.c index 36cc7b663..2f497bf44 100755 --- a/iguana/iguana_unspents.c +++ b/iguana/iguana_unspents.c @@ -130,7 +130,7 @@ int32_t iguana_spentsinit(struct iguana_info *coin,struct iguana_bundleind *spen spentbp->ramchain.spents[unspentind].hdrsi = bp->hdrsi; flag = 1; if ( S[spendind].external == 0 && spentbp != bp ) - printf("unexpected spendbp: %p bp.[%d] U%d <- S%d.[%d] [%p %p %p]\n",&spentbp->ramchain.spents[unspentind],hdrsi,unspentind,spendind,bp->hdrsi,coin->bundles[0],coin->bundles[1],coin->bundles[2]); + printf("spentsinit unexpected spendbp: %p bp.[%d] U%d <- S%d.[%d] [%p %p %p]\n",&spentbp->ramchain.spents[unspentind],hdrsi,unspentind,spendind,bp->hdrsi,coin->bundles[0],coin->bundles[1],coin->bundles[2]); } else if ( S[spendind].prevout < 0 ) flag = 1; @@ -315,7 +315,7 @@ uint8_t *iguana_rmdarray(struct iguana_info *coin,int32_t *numrmdsp,cJSON *array int32_t iguana_utxogen(struct iguana_info *coin,struct iguana_bundle *bp) { static uint64_t total,emitted; - int32_t spendind,n,emit=0; uint32_t unspentind; struct iguana_bundle *spentbp; + int32_t spendind,n,errs=0,emit=0; uint32_t unspentind; struct iguana_bundle *spentbp; FILE *fp; char fname[1024],str[65],dirname[128]; int32_t hdrsi,retval = -1; bits256 zero,sha256; struct iguana_spend *S,*s; struct iguana_bundleind *ptr; struct iguana_ramchain *ramchain; ramchain = &bp->ramchain; @@ -344,11 +344,14 @@ int32_t iguana_utxogen(struct iguana_info *coin,struct iguana_bundle *bp) //spentbp->ramchain.spents[unspentind].ind = spendind; //spentbp->ramchain.spents[unspentind].hdrsi = bp->hdrsi; if ( spentbp == bp ) - printf("unexpected spendbp: %p bp.[%d] U%d <- S%d.[%d] [%p %p %p]\n",&spentbp->ramchain.spents[unspentind],spentbp->hdrsi,unspentind,spendind,bp->hdrsi,coin->bundles[0],coin->bundles[1],coin->bundles[2]); + { + printf("unexpected spendbp: %p bp.[%d] U%d <- S%d.[%d] [ext.%d prev.%d]\n",&spentbp->ramchain.spents[unspentind],spentbp->hdrsi,unspentind,spendind,bp->hdrsi,s->external,s->prevout); + errs++; + } } else printf("unresolved spendind.%d hdrsi.%d\n",spendind,bp->hdrsi); } } - if ( emit >= 0 ) + if ( errs == 0 && emit >= 0 ) { emitted += emit; memset(zero.bytes,0,sizeof(zero)); @@ -374,8 +377,8 @@ int32_t iguana_utxogen(struct iguana_info *coin,struct iguana_bundle *bp) } else printf("error getting utxo fname\n"); } free(ptr); - printf("utxo %d spendinds.[%d] [%.2f%%] emitted.%d %s of %d | ",spendind,bp->hdrsi,100.*(double)emitted/(total+1),emit,mbstr(str,sizeof(*ptr) * emit),n); - return(0); + printf("utxo %d spendinds.[%d] errs.%d [%.2f%%] emitted.%d %s of %d | ",spendind,bp->hdrsi,errs,100.*(double)emitted/(total+1),emit,mbstr(str,sizeof(*ptr) * emit),n); + return(-errs); } int32_t iguana_balancegen(struct iguana_info *coin,struct iguana_bundle *bp)