Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
5326a68ab0
  1. 10
      iguana/iguana_bundles.c
  2. 10
      iguana/iguana_recv.c

10
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); //printf("SET MAXBUNDLES.%d pend.%d\n",bp->hdrsi,pending);
} }
if ( firstgap == 0 && (bp->emitfinish == 0 || bp->n < coin->chain->bundlesize) ) 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; firstgap = bp;
}
if ( bp->emitfinish == 0 ) if ( bp->emitfinish == 0 )
{ {
spaceused += bp->estsize; spaceused += bp->estsize;
@ -1022,7 +1025,10 @@ void iguana_bundlestats(struct iguana_info *coin,char *str)
tmp %= 1000000000; tmp %= 1000000000;
difft.millis = ((double)tmp / 1000000.); difft.millis = ((double)tmp / 1000000.);
if ( (coin->current= firstgap) == 0 ) 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 ) if ( lastpending != 0 )
coin->lastpending = lastpending; coin->lastpending = lastpending;
else coin->lastpending = coin->bundles[coin->bundlescount - 1]; 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->spaceused = spaceused;
coin->numverified = numv; coin->numverified = numv;
char str4[65],str5[65]; 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)); //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 ) if ( time(NULL) > lastdisp+10 )
{ {

10
iguana/iguana_recv.c

@ -768,7 +768,7 @@ struct iguana_bundlereq *iguana_recvblock(struct iguana_info *coin,struct iguana
break; break;
if ( prev->fpipbits == 0 ) 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; prev->newtx = 1;
iguana_blockQ("autoprev",coin,0,-1,prev->RO.hash2,0); 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; i<coin->bundlescount; i++) for (i=0; i<coin->bundlescount; 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; 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); //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 ) 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 ) else if ( bp->numhashes < bp->n )
z = 1; 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); //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); 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; 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 ( 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); printf("SKIP %p[%d] %d\n",bp,bp!=0?bp->bundleheight:-1,req->bundlei);
} }
else else

Loading…
Cancel
Save