diff --git a/iguana/iguana777.c b/iguana/iguana777.c index 22cc46e86..b34c63e4b 100755 --- a/iguana/iguana777.c +++ b/iguana/iguana777.c @@ -380,19 +380,16 @@ 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 ( bp->utxofinish > 1 || (retval= iguana_spendvectors(coin,bp,&bp->ramchain,0,bp->n,convertflag)) >= 0 ) { - if ( (retval= iguana_spendvectors(coin,bp,&bp->ramchain,0,bp->n,convertflag)) >= 0 ) + //printf("spendvectors retval.%d\n",retval); + if ( retval > 0 ) { - //printf("spendvectors retval.%d\n",retval); - if ( retval > 0 ) - { - printf("GENERATED UTXO.%d for ht.%d duration %d seconds\n",bp->hdrsi,bp->bundleheight,(uint32_t)time(NULL) - bp->startutxo); - num++; - } - bp->utxofinish = (uint32_t)time(NULL); - } else printf("UTXO gen.[%d] utxo error\n",bp->hdrsi); - } + printf("GENERATED UTXO.%d for ht.%d duration %d seconds\n",bp->hdrsi,bp->bundleheight,(uint32_t)time(NULL) - bp->startutxo); + num++; + } + bp->utxofinish = (uint32_t)time(NULL); + } else printf("UTXO gen.[%d] utxo error\n",bp->hdrsi); } while ( (n= iguana_utxofinished(coin)) < max ) { diff --git a/iguana/iguana_bundles.c b/iguana/iguana_bundles.c index cec987d03..7af8999eb 100755 --- a/iguana/iguana_bundles.c +++ b/iguana/iguana_bundles.c @@ -735,7 +735,7 @@ int32_t iguana_bundleready(struct iguana_info *coin,struct iguana_bundle *bp,int } else { -#ifndef __PNACL__ +//#ifndef __PNACL__ int32_t checki,hdrsi; FILE *fp; fname[0] = 0; checki = iguana_peerfname(coin,&hdrsi,GLOBAL_TMPDIR,fname,0,block->RO.hash2,zero,1,0); @@ -750,7 +750,7 @@ int32_t iguana_bundleready(struct iguana_info *coin,struct iguana_bundle *bp,int fclose(fp); } else -#endif +//#endif { iguana_blockunmark(coin,block,bp,i,1); if ( requiredflag != 0 ) diff --git a/iguana/iguana_unspents.c b/iguana/iguana_unspents.c index 9a330184b..655e6e42b 100755 --- a/iguana/iguana_unspents.c +++ b/iguana/iguana_unspents.c @@ -1840,24 +1840,31 @@ int32_t iguana_realtime_update(struct iguana_info *coin) double startmillis0; static double totalmillis0; static int32_t num0; struct iguana_bundle *bp; struct iguana_ramchaindata *rdata; int32_t bundlei,i,n,flag=0; bits256 hash2; struct iguana_peer *addr; struct iguana_block *block=0; struct iguana_blockRO *B; struct iguana_ramchain *dest=0,blockR; - bp = coin->current; - if ( bp != 0 && coin->RTdatabad != 0 ) + if ( coin->spendvectorsaved != 1 && coin->bundlescount-1 != coin->balanceswritten ) { - iguana_RTramchainfree(coin); - iguana_RTramchainalloc("RTbundle",coin,bp); - for (i=0; ihdrsi; i++) + coin->spendvectorsaved = 1; + return(0); + //printf("RT mismatch %d != %d\n",coin->bundlescount-1,coin->balanceswritten); + } + if ( coin->spendvectorsaved <= 1 ) + return(0); + for (i=0; ibundlescount-1; i++) + { + if ( (bp= coin->bundles[i]) != 0 && bp->utxofinish == 0 ) { - if ( (bp= coin->bundles[i]) != 0 && bp->utxofinish == 0 ) + if ( iguana_spendvectors(coin,bp,&bp->ramchain,0,bp->n,0) < 0 ) { - if ( iguana_spendvectors(coin,bp,&bp->ramchain,0,bp->n,0) < 0 ) - { - printf("error generating spendvectors.[%d], exiting. just restart iguana\n",i); - exit(-1); - } - } + printf("error generating spendvectors.[%d], exiting. just restart iguana\n",i); + exit(-1); + } else printf("generated UTXO.[%d]\n",i); } } bp = coin->current; + if ( bp != 0 && coin->RTdatabad != 0 ) + { + iguana_RTramchainfree(coin); + iguana_RTramchainalloc("RTbundle",coin,bp); + } if ( bp != 0 && bp->hdrsi == coin->longestchain/coin->chain->bundlesize && bp->hdrsi == coin->balanceswritten && coin->RTheight >= bp->bundleheight && coin->RTheight < bp->bundleheight+bp->n && ((coin->RTheight <= coin->blocks.hwmchain.height && time(NULL) > bp->lastRT) || time(NULL) > bp->lastRT+10) ) { if ( (block= bp->blocks[0]) == 0 || block->txvalid == 0 || block->mainchain == 0 ) diff --git a/iguana/main.c b/iguana/main.c index 1bf3e82ad..d873408fa 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -68,7 +68,7 @@ int32_t HDRnet,netBLOCKS; cJSON *API_json; #ifdef __PNACL__ -char GLOBAL_TMPDIR[512] = "/tmp"; +char GLOBAL_TMPDIR[512] = "/DB/tmp"; char GLOBAL_DBDIR[512] = "/DB"; char GLOBAL_HELPDIR[512] = "/DB/help"; char GLOBAL_VALIDATEDIR[512] = "/DB/purgeable";