From 5326a68ab05639d079d41f23175aa588e0e18a65 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 22 Mar 2016 02:41:06 -0300 Subject: [PATCH] test --- iguana/iguana_bundles.c | 10 ++++++++-- iguana/iguana_recv.c | 10 +++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/iguana/iguana_bundles.c b/iguana/iguana_bundles.c index d2eaa2a20..2269bc8a7 100755 --- a/iguana/iguana_bundles.c +++ b/iguana/iguana_bundles.c @@ -985,7 +985,10 @@ void iguana_bundlestats(struct iguana_info *coin,char *str) //printf("SET MAXBUNDLES.%d pend.%d\n",bp->hdrsi,pending); } if ( firstgap == 0 && (bp->emitfinish == 0 || bp->n < coin->chain->bundlesize) ) + { + printf("firstgap <- [%d] emit.%u bp->n.%d\n",bp->hdrsi,bp->emitfinish,bp->n); firstgap = bp; + } if ( bp->emitfinish == 0 ) { spaceused += bp->estsize; @@ -1022,7 +1025,10 @@ void iguana_bundlestats(struct iguana_info *coin,char *str) tmp %= 1000000000; difft.millis = ((double)tmp / 1000000.); if ( (coin->current= firstgap) == 0 ) - coin->current = coin->bundlescount > 0 ? coin->bundles[coin->bundlescount-1] : coin->bundles[0]; + { + firstgap = coin->current = (coin->bundlescount > 0) ? coin->bundles[coin->bundlescount-1] : coin->bundles[0]; + //printf("bundlescount.%d %p[%d]\n",coin->bundlescount,coin->current,coin->current->hdrsi); + } if ( lastpending != 0 ) coin->lastpending = lastpending; else coin->lastpending = coin->bundles[coin->bundlescount - 1]; @@ -1030,7 +1036,7 @@ void iguana_bundlestats(struct iguana_info *coin,char *str) coin->spaceused = spaceused; coin->numverified = numv; char str4[65],str5[65]; - sprintf(str,"u.%d b.%d v.%d/%d (%d 1st.%d) to %d N[%d] Q.%d h.%d r.%d c.%s s.%d d.%d E.%d:%d est.%d %s %d:%02d:%02d %03.3f peers.%d/%d Q.(%d %d) L.%d M.%d %s",numutxo,numbalances,numv,coin->pendbalances,firstgap!=0?firstgap->numsaved:0,firstgap!=0?firstgap->hdrsi:0,coin->lastpending!=0?coin->lastpending->hdrsi:0,count,coin->numbundlesQ,numhashes,coin->blocksrecv,mbstr(str4,spaceused),numsaved,done,numemit,coin->numreqsent,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),coin->longestchain,coin->blocks.hwmchain.height,bits256_str(str5,coin->blocks.hwmchain.RO.hash2)); + sprintf(str,"u.%d b.%d v.%d/%d (%d 1st.%d) to %d N[%d] Q.%d h.%d r.%d c.%s s.%d d.%d E.%d:%d est.%d %s %d:%02d:%02d %03.3f peers.%d/%d Q.(%d %d) L.%d M.%d %s",numutxo,numbalances,numv,coin->pendbalances,firstgap!=0?firstgap->numsaved:-1,firstgap!=0?firstgap->hdrsi:-1,coin->lastpending!=0?coin->lastpending->hdrsi:0,count,coin->numbundlesQ,numhashes,coin->blocksrecv,mbstr(str4,spaceused),numsaved,done,numemit,coin->numreqsent,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),coin->longestchain,coin->blocks.hwmchain.height,bits256_str(str5,coin->blocks.hwmchain.RO.hash2)); //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 7a38be960..9ed684944 100755 --- a/iguana/iguana_recv.c +++ b/iguana/iguana_recv.c @@ -768,7 +768,7 @@ struct iguana_bundlereq *iguana_recvblock(struct iguana_info *coin,struct iguana break; if ( prev->fpipbits == 0 ) { - printf("width.%d auto prev newtx %s\n",width,bits256_str(str,prev->RO.hash2)); + //printf("width.%d auto prev newtx %s\n",width,bits256_str(str,prev->RO.hash2)); prev->newtx = 1; iguana_blockQ("autoprev",coin,0,-1,prev->RO.hash2,0); } @@ -1084,10 +1084,10 @@ int32_t iguana_reqhdrs(struct iguana_info *coin) { for (i=0; ibundlescount; i++) { - if ( (bp= coin->bundles[i]) != 0 && (bp->numhashes < bp->n || i == coin->bundlescount-1) && (bp->speculative == 0 || bp->numspec < bp->n) ) + if ( (bp= coin->bundles[i]) != 0 && (bp == coin->current || i == coin->bundlescount-1 || bp->numhashes < bp->n) ) { lag = 30; - if ( bp->bundleheight+bp->numhashes < coin->longestchain && time(NULL) > bp->issuetime+lag ) + if ( bp->bundleheight < coin->longestchain && time(NULL) > bp->issuetime+lag ) { //printf("LAG.%ld hdrsi.%d numhashes.%d:%d needhdrs.%d qsize.%d zcount.%d\n",time(NULL)-bp->hdrtime,i,bp->numhashes,bp->n,iguana_needhdrs(coin),queue_size(&coin->hdrsQ),coin->zcount); if ( bp->issuetime == 0 ) @@ -1213,7 +1213,7 @@ int32_t iguana_pollQsPT(struct iguana_info *coin,struct iguana_peer *addr) else if ( bp->numhashes < bp->n ) z = 1; } - if ( bp == 0 || z != 0 ) + if ( bp == 0 || z != 0 || bp == coin->current ) { //printf("%s request HDR.(%s) numhashes.%d\n",addr!=0?addr->ipaddr:"local",hashstr,bp!=0?bp->numhashes:0); iguana_send(coin,addr,serialized,datalen); @@ -1261,7 +1261,7 @@ int32_t iguana_pollQsPT(struct iguana_info *coin,struct iguana_peer *addr) else block = 0; if ( priority == 0 && bp != 0 && req->bundlei >= 0 && req->bundlei < bp->n && req->bundlei < coin->chain->bundlesize && block != 0 && (block->fpipbits != 0 || block->queued != 0) ) { - //if ( 1 && priority != 0 ) + if ( 1 && priority != 0 ) printf("SKIP %p[%d] %d\n",bp,bp!=0?bp->bundleheight:-1,req->bundlei); } else