diff --git a/iguana/iguana_bundles.c b/iguana/iguana_bundles.c index 6a1333eb3..c752bc337 100755 --- a/iguana/iguana_bundles.c +++ b/iguana/iguana_bundles.c @@ -696,10 +696,13 @@ int32_t iguana_bundlehdr(struct iguana_info *coin,struct iguana_bundle *bp,int32 { printf("speculativeB.[%d:%d]\n",bp->hdrsi,i); iguana_blockQ("speculativeB",coin,bp,i,block->RO.hash2,1); + continue; } - else if ( bits256_nonz(bp->hashes[i]) != 0 )//&& now > bp->issued[i]+60 ) + if ( bits256_nonz(bp->speculative[i]) != 0 && now > bp->issued[i]+13 ) { - iguana_blockQ("speculativeC",coin,bp,i,bp->hashes[i],0); + //printf("speculativeC [%d:%d]\n",bp->hdrsi,i); + iguana_blockQ("speculativeC",coin,bp,-i,bp->speculative[i],0); + bp->issued[i] = now; } } } @@ -1101,7 +1104,7 @@ void iguana_bundlestats(struct iguana_info *coin,char *str) } } int32_t checki,hdrsi,havefile,missing,recvlen; char fname[1024]; FILE *fp; struct iguana_msghdr H; static bits256 zero; - //if ( bp->speculative != 0 ) + if ( bp->speculative != 0 ) { now = (int32_t)time(NULL); for (j=havefile=missing=0; jn; j++) diff --git a/iguana/iguana_recv.c b/iguana/iguana_recv.c index f5fb082c9..d1fea1585 100755 --- a/iguana/iguana_recv.c +++ b/iguana/iguana_recv.c @@ -177,7 +177,7 @@ int32_t iguana_speculativefind(struct iguana_info *coin,struct iguana_bundle *bp for (j=numcached=0; jn; j++) if ( bp->speculativecache[j] != 0 ) numcached++; - //printf("cache %s [%d:%d] h.%d s.%d c.%d -> %d\n",bits256_str(str,block->RO.hash2),bp->hdrsi,i,bp->numhashes,bp->numsaved,bp->numcached,numcached); + printf("cache %s [%d:%d] h.%d s.%d c.%d -> %d\n",bits256_str(str,block->RO.hash2),bp->hdrsi,i,bp->numhashes,bp->numsaved,bp->numcached,numcached); return(i); } } @@ -670,6 +670,9 @@ struct iguana_bundlereq *iguana_recvblockhdrs(struct iguana_info *coin,struct ig if ( (bp= iguana_bundleset(coin,&block,&bundlei,&blocks[i])) != 0 ) { bp->dirty++; + if ( bp->issued[bundlei] == 0 ) + iguana_blockQ("recvhdr",coin,bp,bundlei,block[i].RO.hash2,0); + //printf("{%d:%d} ",bp->hdrsi,bundlei); if ( i == 0 ) { @@ -759,7 +762,11 @@ struct iguana_bundlereq *iguana_recvblockhashes(struct iguana_info *coin,struct if ( bp->speculative == 0 ) bp->speculative = mycalloc('s',bp->n+1,sizeof(*bp->speculative)); for (i=bp->numspec; in; i++) + { bp->speculative[i] = blockhashes[i]; + //printf("speculate new issue [%d:%d]\n",bp->hdrsi,i); + iguana_blockQ("speculate",coin,bp,-i,blockhashes[i],0); + } bp->numspec = num <= bp->n+1 ? num : bp->n+1; //iguana_blockQ(coin,0,-1,blockhashes[2],1); }