diff --git a/iguana/iguana777.h b/iguana/iguana777.h index 93211c06e..303845000 100755 --- a/iguana/iguana777.h +++ b/iguana/iguana777.h @@ -472,7 +472,7 @@ struct iguana_info portable_mutex_t scripts_mutex[2]; FILE *scriptsfp[2]; void *scriptsptr[2]; long scriptsfilesize[2]; //struct scriptinfo *scriptstable[2]; struct iguana_bundle *bundles[IGUANA_MAXBUNDLES],*current; - int32_t numremain,numpendings,zcount,recvcount,bcount,pcount,lastbundle; + int32_t numremain,numpendings,zcount,recvcount,bcount,pcount,lastbundle,numsaved; uint32_t recvtime,hdrstime,backstoptime,lastbundletime,numreqsent,numbundlesQ,lastbundleitime; double backstopmillis; bits256 backstophash2; int32_t initialheight,mapflags,minconfirms,numrecv,bindsock,isRT,backstop,blocksrecv,merging,polltimeout,numreqtxids,allhashes; bits256 reqtxids[64]; diff --git a/iguana/iguana_bundles.c b/iguana/iguana_bundles.c index a2b8ecea0..b1a88611d 100755 --- a/iguana/iguana_bundles.c +++ b/iguana/iguana_bundles.c @@ -507,6 +507,7 @@ void iguana_bundlestats(struct iguana_info *coin,char *str) tmp %= 1000000000; difft.millis = ((double)tmp / 1000000.); coin->current = firstgap; + coin->numsaved = numsaved; sprintf(str,"1st.%d N[%d] Q.%d h.%d r.%d c.%d:%d:%d s.%d d.%d E.%d:%d M.%d L.%d est.%d %s %d:%02d:%02d %03.3f peers.%d/%d Q.(%d %d)",firstgap!=0?firstgap->hdrsi:0,count,coin->numbundlesQ,numhashes,coin->blocksrecv,coin->numcached,numcached,coin->cachefreed,numsaved,done,numemit,coin->numreqsent,coin->blocks.hwmchain.height,coin->longestchain,coin->MAXBUNDLES,mbstr(str2,estsize),(int32_t)difft.x/3600,(int32_t)(difft.x/60)%60,(int32_t)difft.x%60,difft.millis,p,coin->MAXPEERS,queue_size(&coin->priorityQ),queue_size(&coin->blocksQ)); //sprintf(str+strlen(str),"%s.%-2d %s time %.2f files.%d Q.%d %d\n",coin->symbol,flag,str,(double)(time(NULL)-coin->starttime)/60.,coin->peers.numfiles,queue_size(&coin->priorityQ),queue_size(&coin->blocksQ)); if ( time(NULL) > lastdisp+10 ) diff --git a/iguana/iguana_recv.c b/iguana/iguana_recv.c index 87785c706..8d4c390a0 100755 --- a/iguana/iguana_recv.c +++ b/iguana/iguana_recv.c @@ -422,7 +422,7 @@ int32_t iguana_bundlekick(struct iguana_info *coin,struct iguana_bundle *bp,int3 { if ( (block= bp->blocks[i]) != 0 ) { - if ( block->fpipbits == 0 )//|| block->RO.recvlen == 0 ) + if ( block->fpipbits == 0 || block->RO.recvlen == 0 ) { if ( bp->issued[i] == 0 || now > bp->issued[i]+10 ) { @@ -571,9 +571,18 @@ int32_t iguana_bundleiters(struct iguana_info *coin,struct iguana_bundle *bp,int issued = 0; max = 100 + (bp->n/coin->MAXBUNDLES)*(bp->hdrsi - starti); iguana_bundlekick(coin,bp,starti,max); - r = (rand() % 8); - if ( starti+r < coin->bundlescount && coin->bundles[starti+r] != 0 ) - iguana_bundlekick(coin,coin->bundles[starti+r],starti+r,coin->bundles[starti+r]->n); + if ( coin->numsaved > coin->longestchain*.99 ) + { + printf("last percent via hdrsi.%d\n",bp->hdrsi); + for (r=starti; rbundlescount; r++) + iguana_bundlekick(coin,coin->bundles[r],r,coin->bundles[r]->n); + } + else + { + r = (rand() % 16); + if ( starti+r < coin->bundlescount && coin->bundles[starti+r] != 0 ) + iguana_bundlekick(coin,coin->bundles[starti+r],starti+r,coin->bundles[starti+r]->n); + } endmillis = OS_milliseconds() + timelimit + (rand() % 1000); if ( bp->numsaved < bp->n ) width = 100 + max*100;//sqrt(sqrt(bp->n * (1+bp->numsaved+issued)) * (10+coin->bundlescount-bp->hdrsi));