diff --git a/iguana/iguana777.h b/iguana/iguana777.h index 1c212850d..b911e86ed 100755 --- a/iguana/iguana777.h +++ b/iguana/iguana777.h @@ -823,6 +823,7 @@ int32_t iguana_mapchaininit(struct iguana_info *coin,struct iguana_ramchain *map void iguana_autoextend(struct iguana_info *coin,struct iguana_bundle *bp); void iguana_RTramchainfree(struct iguana_info *coin); void iguana_coinpurge(struct iguana_info *coin); +int32_t iguana_setmaxbundles(struct iguana_info *coin); extern int32_t HDRnet,netBLOCKS; diff --git a/iguana/iguana_blocks.c b/iguana/iguana_blocks.c index afd8970fe..bfee915f5 100755 --- a/iguana/iguana_blocks.c +++ b/iguana/iguana_blocks.c @@ -274,7 +274,7 @@ struct iguana_block *_iguana_chainlink(struct iguana_info *coin,struct iguana_bl if ( newblock == 0 ) return(0); hwmchain = &coin->blocks.hwmchain; - if ( hwmchain->height > 0 && ((bp= coin->current) == 0 || hwmchain->height/coin->chain->bundlesize > bp->hdrsi) ) + if ( hwmchain->height > 0 && ((bp= coin->current) == 0 || hwmchain->height/coin->chain->bundlesize >= bp->hdrsi-coin->isRT) ) return(0); if ( (block= iguana_blockfind(coin,newblock->RO.hash2)) != 0 ) { diff --git a/iguana/iguana_bundles.c b/iguana/iguana_bundles.c index 7da36499d..10ff52f50 100755 --- a/iguana/iguana_bundles.c +++ b/iguana/iguana_bundles.c @@ -663,19 +663,26 @@ int32_t iguana_bundlehdr(struct iguana_info *coin,struct iguana_bundle *bp,int32 return(counter); } -int32_t iguana_bundletweak(struct iguana_info *coin,struct iguana_bundle *bp) +int32_t iguana_setmaxbundles(struct iguana_info *coin) { - struct iguana_bundle *lastbp; double completed; - if ( coin->current == bp ) - coin->current = coin->bundles[bp->hdrsi+1]; - if ( (lastbp= coin->lastpending) != 0 && lastbp->hdrsi < coin->bundlescount-1 ) - coin->lastpending = coin->bundles[lastbp->hdrsi + 1]; + double completed; if ( coin->current != 0 && coin->bundlescount != 0 ) { completed = ((double)coin->current->hdrsi + 1) / coin->bundlescount; coin->MAXBUNDLES = (double)(coin->endPEND - coin->startPEND)*completed + coin->startPEND; printf("MAXBUNDLES %d (%d -> %d) completed %.3f\n",coin->MAXBUNDLES,coin->startPEND,coin->endPEND,completed); } + return(coin->MAXBUNDLES); +} + +int32_t iguana_bundletweak(struct iguana_info *coin,struct iguana_bundle *bp) +{ + struct iguana_bundle *lastbp; + if ( coin->current == bp ) + coin->current = coin->bundles[bp->hdrsi+1]; + if ( (lastbp= coin->lastpending) != 0 && lastbp->hdrsi < coin->bundlescount-1 ) + coin->lastpending = coin->bundles[lastbp->hdrsi + 1]; + iguana_setmaxbundles(coin); /*if ( (rand() % 3) == 0 ) { if ( coin->MAXBUNDLES > coin->endPEND ) @@ -1149,6 +1156,7 @@ void iguana_bundlestats(struct iguana_info *coin,char *str) if ( firstgap != 0 && firstgap->queued == 0 ) iguana_bundleQ(coin,firstgap,1000); } + iguana_setmaxbundles(coin); strcpy(coin->statusstr,str); coin->estsize = estsize; }