diff --git a/iguana/iguana777.h b/iguana/iguana777.h index dabe8391a..ed7463ad1 100755 --- a/iguana/iguana777.h +++ b/iguana/iguana777.h @@ -461,7 +461,7 @@ struct iguana_info uint64_t instance_nonce,myservices,totalsize,totalrecv,totalpackets,sleeptime; int64_t mining,totalfees,TMPallocated,MAXRECVCACHE,MAXMEM,estsize,activebundles; int32_t MAXPEERS,MAXPENDING,MAXBUNDLES,active,closestbundle,numemitted,lastsweep,startutc,newramchain,numcached,cachefreed,helperdepth,startPEND,endPEND,enableCACHE,RELAYNODE,VALIDATENODE,balanceswritten,RTheight; bits256 balancehash; - uint32_t lastsync,parsetime,numiAddrs,firstblock,lastpossible,bundlescount,savedblocks; + uint32_t lastsync,parsetime,numiAddrs,firstblock,lastpossible,bundlescount,savedblocks,backlog; int32_t longestchain,badlongestchain,longestchain_strange; struct tai starttime; double startmillis; struct iguana_chain *chain; diff --git a/iguana/iguana_bundles.c b/iguana/iguana_bundles.c index 586e30d80..75af37430 100755 --- a/iguana/iguana_bundles.c +++ b/iguana/iguana_bundles.c @@ -541,7 +541,7 @@ int32_t iguana_bundleissue(struct iguana_info *coin,struct iguana_bundle *bp,int saved = block->issued; if ( bp == coin->current ) forceflag = (now > block->issued + lag); - else forceflag = (now > block->issued + 3*lag); + else forceflag = (now > block->issued + 10*lag); if ( priority != 0 ) { //printf("[%d:%d] ",bp->hdrsi,i); @@ -561,8 +561,8 @@ int32_t iguana_bundleissue(struct iguana_info *coin,struct iguana_bundle *bp,int if ( flag != 0 && priority != 0 && laggard != 0 && coin->current == bp ) printf("[%d] reissued.%d currentflag.%d ht.%d s.%d finished.%d most.%d laggards.%d maxunfinished.%d\n",bp->hdrsi,flag,bp->currentflag,bp->bundleheight,bp->numsaved,finished,doneval,laggard,maxval); } - if ( bp == coin->current ) - return(counter); + //if ( bp == coin->current ) + // return(counter); } for (i=0; in; i++) { @@ -575,7 +575,7 @@ int32_t iguana_bundleissue(struct iguana_info *coin,struct iguana_bundle *bp,int block->numrequests++; if ( bp == coin->current ) printf("[%d:%d].%x ",bp->hdrsi,i,block->fpipbits); - iguana_blockQ("kickc",coin,bp,i,block->RO.hash2,bp == coin->current || now > block->issued+lag*3); + iguana_blockQ("kickc",coin,bp,i,block->RO.hash2,bp == coin->current && now > block->issued+lag); bp->issued[i] = block->issued = now; counter++; if ( --max <= 0 ) @@ -587,7 +587,7 @@ int32_t iguana_bundleissue(struct iguana_info *coin,struct iguana_bundle *bp,int { if ( bp == coin->current ) printf("[%d:%d].%x ",bp->hdrsi,i,block->fpipbits); - iguana_blockQ("kickd",coin,bp,i,bp->hashes[i],bp == coin->current || now > bp->issued[i]+lag*3); + iguana_blockQ("kickd",coin,bp,i,bp->hashes[i],bp == coin->current && now > bp->issued[i]+lag*3); bp->issued[i] = now; counter++; } diff --git a/iguana/iguana_peers.c b/iguana/iguana_peers.c index f83420a55..2b5aef7aa 100755 --- a/iguana/iguana_peers.c +++ b/iguana/iguana_peers.c @@ -1069,7 +1069,7 @@ void iguana_dedicatedloop(struct iguana_info *coin,struct iguana_peer *addr) } else if ( addr->rank != 1 ) usleep(coin->polltimeout*5000 + 1*(rand() % (coin->polltimeout*3000))); - else usleep(10000); + else usleep(10000 + coin->backlog); } else run >>= 2; } if ( flag != 0 ) diff --git a/iguana/iguana_recv.c b/iguana/iguana_recv.c index 295a820bc..4416a58bf 100755 --- a/iguana/iguana_recv.c +++ b/iguana/iguana_recv.c @@ -1181,7 +1181,7 @@ struct iguana_blockreq { struct queueitem DL; bits256 hash2,*blockhashes; struct int32_t iguana_blockQ(char *argstr,struct iguana_info *coin,struct iguana_bundle *bp,int32_t bundlei,bits256 hash2,int32_t priority) { - queue_t *Q; char *str; int32_t height = -1; struct iguana_blockreq *req; struct iguana_block *block = 0; + queue_t *Q; char *str; int32_t n,height = -1; struct iguana_blockreq *req; struct iguana_block *block = 0; if ( bits256_nonz(hash2) == 0 ) { printf("cant queue zerohash bundlei.%d\n",bundlei); @@ -1229,8 +1229,14 @@ int32_t iguana_blockQ(char *argstr,struct iguana_info *coin,struct iguana_bundle req->height = height; req->bundlei = bundlei; char str2[65]; - if ( Q == &coin->blocksQ && queue_size(Q) > 100000 ) - printf("%s %s %s [%d:%d] %d %s %d numranked.%d qsize.%d\n",coin->symbol,argstr,str,bp!=0?bp->hdrsi:-1,bundlei,req->height,bits256_str(str2,hash2),coin->blocks.recvblocks,coin->peers.numranked,queue_size(Q)); + if ( Q == &coin->blocksQ ) + { + if ( (n= queue_size(Q)) > 100000 ) + { + printf("%s %s %s [%d:%d] %d %s %d numranked.%d qsize.%d\n",coin->symbol,argstr,str,bp!=0?bp->hdrsi:-1,bundlei,req->height,bits256_str(str2,hash2),coin->blocks.recvblocks,coin->peers.numranked,queue_size(Q)); + coin->backlog = n; + } else coin->backlog >>= 1; + } if ( block != 0 ) { block->numrequests++;