diff --git a/iguana/iguana_bundles.c b/iguana/iguana_bundles.c index 88352fc9c..a29e41a13 100755 --- a/iguana/iguana_bundles.c +++ b/iguana/iguana_bundles.c @@ -863,6 +863,7 @@ int32_t iguana_bundleiters(struct iguana_info *coin,struct OS_memspace *mem,stru if ( coin->stucktime != 0 ) { lag = (int32_t)time(NULL) - coin->stucktime; + printf("NONZ stucktime.%u lag.%d iters.%d vs %d\n",coin->stucktime,lag,coin->stuckiters,lag/coin->MAXSTUCKTIME); if ( (lag/coin->MAXSTUCKTIME) > coin->stuckiters ) { coin->stuckiters = (int32_t)(lag/coin->MAXSTUCKTIME); @@ -1050,18 +1051,19 @@ void iguana_bundlestats(struct iguana_info *coin,char *str,int32_t lag) { done++; numemit++; - printf("finished.[%d]\n",bp->hdrsi); + //printf("finished.[%d]\n",bp->hdrsi); if ( firstgap != 0 && bp->hdrsi > firstgap->hdrsi-3 ) iguana_bundlepurgefiles(coin,bp); } else { - if ( firstgap == 0 && bp->numsaved < bp->n && bp->numcached < bp->n && (bp->emitfinish == 0 || bp->n < coin->chain->bundlesize) ) + if ( firstgap == 0 && bp->numsaved < bp->n && bp->numcached < bp->n && (bp->emitfinish == 0 || bp->hdrsi == coin->longestchain/coin->chain->bundlesize) ) { printf("firstgap <- [%d] emit.%u bp->n.%d numsaved.%d numcached.%d numhashes.%d\n",bp->hdrsi,bp->emitfinish,bp->n,bp->numsaved,bp->numcached,bp->numhashes); firstgap = bp; } - else printf("[%d] emit.%u bp->n.%d numsaved.%d numcached.%d numhashes.%d\n",bp->hdrsi,bp->emitfinish,bp->n,bp->numsaved,bp->numcached,bp->numhashes); + printf("%d ",bp->numsaved); + //else printf("[%d] emit.%u bp->n.%d numsaved.%d numcached.%d numhashes.%d\n",bp->hdrsi,bp->emitfinish,bp->n,bp->numsaved,bp->numcached,bp->numhashes); if ( bp->emitfinish == 0 ) { @@ -1078,6 +1080,7 @@ void iguana_bundlestats(struct iguana_info *coin,char *str,int32_t lag) } } } + printf("lastbp.[%d]\n",lastpending!=0?lastpending->hdrsi:-1); /*if ( m > 0 ) { revsortds(sortbuf,m,sizeof(*sortbuf)*2); diff --git a/iguana/iguana_recv.c b/iguana/iguana_recv.c index 6304a3262..ce3ee09fe 100755 --- a/iguana/iguana_recv.c +++ b/iguana/iguana_recv.c @@ -563,7 +563,7 @@ void iguana_bundlespeculate(struct iguana_info *coin,struct iguana_bundle *bp,in int32_t iguana_bundlehashadd(struct iguana_info *coin,struct iguana_bundle *bp,int32_t bundlei,struct iguana_block *block) { static const bits256 zero; - struct iguana_ramchain blockR; int32_t hdrsi,checki,retval=-1; long size = 0; FILE *fp; char fname[1024]; + struct iguana_ramchain blockR; int32_t hdrsi,firstflag=0,checki,retval=-1; long size = 0; FILE *fp; char fname[1024]; block->bundlei = bundlei; block->hdrsi = bp->hdrsi; if ( bits256_nonz(bp->hashes[bundlei]) != 0 && bits256_cmp(bp->hashes[bundlei],block->RO.hash2) != 0 ) @@ -583,9 +583,11 @@ int32_t iguana_bundlehashadd(struct iguana_info *coin,struct iguana_bundle *bp,i return(-1); } } + if ( bp->blocks[bundlei] == 0 ) + firstflag = 1; bp->blocks[bundlei] = block; iguana_bundlehash2add(coin,0,bp,bundlei,block->RO.hash2); - if ( bp->emitfinish == 0 ) + if ( firstflag != 0 && bp->emitfinish == 0 ) { //block->fpos = -1; if ( 0 && iguana_ramchainfile(coin,0,&blockR,bp,bundlei,block) == 0 )