diff --git a/iguana/iguana_bundles.c b/iguana/iguana_bundles.c index 08b7e7277..2ffbc73c5 100755 --- a/iguana/iguana_bundles.c +++ b/iguana/iguana_bundles.c @@ -667,7 +667,7 @@ int32_t iguana_bundlehdr(struct iguana_info *coin,struct iguana_bundle *bp,int32 bp->hdrtime = (uint32_t)time(NULL); if ( bp == coin->current && bp->speculative != 0 ) { - //printf("iguana_bundlehdr.[%d] %d %s\n",bp->hdrsi,bp->numspec,bits256_str(str,bp->hashes[0])); + printf("iguana_bundlehdr.[%d] %d %s\n",bp->hdrsi,bp->numspec,bits256_str(str,bp->hashes[0])); //if ( iguana_blocksmissing(coin,&avail,missings,0,bp,0,7) > 0 ) // iguana_bundleissuemissing(coin,bp,missings,3); } @@ -699,11 +699,21 @@ int32_t iguana_setmaxbundles(struct iguana_info *coin) int32_t iguana_bundletweak(struct iguana_info *coin,struct iguana_bundle *bp) { - struct iguana_bundle *lastbp; + struct iguana_bundle *lastbp; int32_t i,pending; 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]; + if ( (lastbp= coin->current) != 0 ) + { + for (pending=0,i=lastbp->hdrsi+1; ibundlescount; i++) + { + if ( (lastbp= coin->bundles[i]) != 0 && lastbp->emitfinish == 0 ) + { + if ( ++pending == coin->MAXBUNDLES ) + break; + } + } + coin->lastpending = lastbp; + } iguana_setmaxbundles(coin); return(coin->MAXBUNDLES); } diff --git a/iguana/iguana_recv.c b/iguana/iguana_recv.c index c7f51037b..47ba7cd4f 100755 --- a/iguana/iguana_recv.c +++ b/iguana/iguana_recv.c @@ -792,7 +792,7 @@ struct iguana_bundlereq *iguana_recvblockhashes(struct iguana_info *coin,struct memset(zero.bytes,0,sizeof(zero)); bp = 0, bundlei = -2; iguana_bundlefind(coin,&bp,&bundlei,blockhashes[1]); - if ( 0 && num >= coin->chain->bundlesize ) + if ( 1 && num >= coin->chain->bundlesize ) printf("blockhashes[%d] %d of %d %s bp.%d[%d]\n",num,bp==0?-1:bp->hdrsi,coin->bundlescount,bits256_str(str,blockhashes[1]),bp==0?-1:bp->bundleheight,bundlei); if ( num < 2 ) return(req); @@ -826,11 +826,11 @@ struct iguana_bundlereq *iguana_recvblockhashes(struct iguana_info *coin,struct for (i=bp->numspec; in; i++) { bp->speculative[i] = blockhashes[i]; + if ( bp->blocks[i] == 0 || bp->blocks[i]->issued == 0 ) + iguana_blockQ("speculate",coin,bp,-i,blockhashes[i],0); if ( bp->blocks[i] == 0 ) bp->blocks[i] = iguana_blockhashset("recvhashes3",coin,bp->bundleheight+i,blockhashes[i],1); //printf("speculate new issue [%d:%d]\n",bp->hdrsi,i); - if ( 0 && bp->blocks[i] == 0 ) - iguana_blockQ("speculate",coin,bp,-i,blockhashes[i],0); } bp->speculative[0] = bp->hashes[0]; bp->numspec = num <= bp->n+1 ? num : bp->n+1; @@ -931,7 +931,7 @@ struct iguana_bundlereq *iguana_recvblock(struct iguana_info *coin,struct iguana } } } - if ( 0 )//&& bp != 0 && bp->hdrsi == coin->bundlescount-1 ) + if ( 1 )//&& bp != 0 && bp->hdrsi == coin->bundlescount-1 ) { int32_t i; static int32_t numrecv; numrecv++;