diff --git a/iguana/iguana777.h b/iguana/iguana777.h index a5fd49b57..b0799a2d7 100755 --- a/iguana/iguana777.h +++ b/iguana/iguana777.h @@ -469,7 +469,7 @@ struct iguana_info struct iguana_peers peers; struct iguana_peer internaladdr; uint64_t instance_nonce,myservices,totalsize,totalrecv,totalpackets,sleeptime; int64_t mining,totalfees,TMPallocated,MAXRECVCACHE,MAXMEM,estsize,activebundles; - int32_t MAXPEERS,MAXPENDINGREQUESTS,MAXBUNDLES,MAXSTUCKTIME,active,closestbundle,numemitted,lastsweep,startutc,newramchain,numcached,cachefreed,helperdepth,startPEND,endPEND,enableCACHE,RELAYNODE,VALIDATENODE,balanceswritten,RTheight; bits256 balancehash; + int32_t MAXPEERS,MAXPENDINGREQUESTS,MAXBUNDLES,MAXSTUCKTIME,active,closestbundle,numemitted,lastsweep,startutc,newramchain,numcached,cachefreed,helperdepth,startPEND,endPEND,enableCACHE,RELAYNODE,VALIDATENODE,origbalanceswritten,balanceswritten,RTheight; bits256 balancehash; uint32_t lastsync,parsetime,numiAddrs,lastpossible,bundlescount,savedblocks,backlog; int32_t longestchain,badlongestchain,longestchain_strange,RTramchain_busy,emitbusy,stuckiters; struct tai starttime; double startmillis; diff --git a/iguana/iguana_bundles.c b/iguana/iguana_bundles.c index 91da0931c..f2cf961d1 100755 --- a/iguana/iguana_bundles.c +++ b/iguana/iguana_bundles.c @@ -599,7 +599,7 @@ int32_t iguana_bundlehdr(struct iguana_info *coin,struct iguana_bundle *bp,int32 int32_t counter=0; if ( 0 && bp->isRT == 0 && (bp->hdrsi == coin->bundlescount-1 || bp == coin->current) ) printf("hdr ITERATE.%d bundle.%d vs %d: h.%d n.%d r.%d s.%d c.%d finished.%d spec.%p[%d]\n",bp->hdrsi,bp->bundleheight,coin->longestchain-coin->chain->bundlesize,bp->numhashes,bp->n,bp->numrecv,bp->numsaved,bp->numcached,bp->emitfinish,bp->speculative,bp->numspec); - if ( bp->hdrsi == coin->bundlescount-1 || (coin->enableCACHE != 0 && bp->numhashes < bp->n && (bp->speculative == 0 || bp->hdrsi >= coin->longestchain/bp->n)) ) + if ( bp->hdrsi >= coin->bundlescount-2 || (coin->enableCACHE != 0 && bp->numhashes < bp->n && (bp->speculative == 0 || bp->hdrsi >= coin->longestchain/bp->n)) ) { char str[64]; //printf("hdrs.%s\n",bits256_str(str,bp->hashes[0])); diff --git a/iguana/iguana_init.c b/iguana/iguana_init.c index 8ba34e47a..c78caaeca 100755 --- a/iguana/iguana_init.c +++ b/iguana/iguana_init.c @@ -319,6 +319,7 @@ void iguana_parseline(struct iguana_info *coin,int32_t iter,FILE *fp) } printf("iguana_bundleQ\n"); } + coin->origbalanceswritten = coin->balanceswritten; } } diff --git a/iguana/iguana_recv.c b/iguana/iguana_recv.c index 1044241cc..f2f4957bf 100755 --- a/iguana/iguana_recv.c +++ b/iguana/iguana_recv.c @@ -587,7 +587,7 @@ void iguana_bundlespeculate(struct iguana_info *coin,struct iguana_bundle *bp,in { if ( bp == 0 ) return; - if ( bp->numhashes < bp->n && bundlei == 0 && bp->speculative == 0 && bp->bundleheight < coin->longestchain-coin->chain->bundlesize ) + if ( coin->enableCACHE != 0 && bp->numhashes < bp->n && bundlei == 0 && bp->speculative == 0 && bp->bundleheight < coin->longestchain-coin->chain->bundlesize ) { char str[65]; bits256_str(str,bp->hashes[0]); fprintf(stderr,"Afound block -> %d %d hdr.%s\n",bp->bundleheight,coin->longestchain-coin->chain->bundlesize,str); @@ -849,7 +849,7 @@ struct iguana_bundlereq *iguana_recvblockhashes(struct iguana_info *coin,struct } else if ( bp->hdrsi == coin->bundlescount-1 ) iguana_checklongestchain(coin,bp,num); - if ( (bp->speculative == 0 || num > bp->numspec) && bp->emitfinish == 0 ) + if ( coin->enableCACHE != 0 && (bp->speculative == 0 || num > bp->numspec) && bp->emitfinish == 0 ) { //printf("FOUND speculative.%s BLOCKHASHES[%d] ht.%d\n",bits256_str(str,blockhashes[1]),num,bp->bundleheight); if ( bp->speculative == 0 ) diff --git a/iguana/iguana_unspents.c b/iguana/iguana_unspents.c index 9ec2dc2fd..712508669 100755 --- a/iguana/iguana_unspents.c +++ b/iguana/iguana_unspents.c @@ -1350,11 +1350,10 @@ int32_t iguana_realtime_update(struct iguana_info *coin) int32_t iguana_balanceflush(struct iguana_info *coin,int32_t refhdrsi,int32_t purgedist) { - int32_t hdrsi,numpkinds,iter,numhdrsi,numunspents,err,origcount; struct iguana_bundle *bp; + int32_t hdrsi,numpkinds,iter,numhdrsi,numunspents,err; struct iguana_bundle *bp; char fname[1024],fname2[1024],destfname[1024]; bits256 balancehash; FILE *fp,*fp2; struct iguana_utxo *Uptr; struct iguana_account *Aptr; struct sha256_vstate vstate; vupdate_sha256(balancehash.bytes,&vstate,0,0); - origcount = coin->balanceswritten; for (hdrsi=0; hdrsibundlescount; hdrsi++) if ( (bp= coin->bundles[hdrsi]) == 0 || bp->balancefinish <= 1 || bp->ramchain.H.data == 0 || bp->ramchain.A == 0 || bp->ramchain.Uextras == 0 ) break; @@ -1466,7 +1465,7 @@ int32_t iguana_balanceflush(struct iguana_info *coin,int32_t refhdrsi,int32_t pu printf("error mapping bundle.[%d]\n",hdrsi); } char str[65]; printf("BALANCES WRITTEN for %d/%d bundles %s\n",coin->balanceswritten,origcount,bits256_str(str,coin->balancehash)); - if ( strcmp(coin->symbol,"BTC") == 0 && coin->balanceswritten > origcount+10 ) + if ( strcmp(coin->symbol,"BTC") == 0 && coin->balanceswritten > coin->balanceswritten+10 ) { int32_t i; coin->active = 0;