diff --git a/iguana/iguana_bundles.c b/iguana/iguana_bundles.c index 4ab189af2..a68190c44 100755 --- a/iguana/iguana_bundles.c +++ b/iguana/iguana_bundles.c @@ -1191,8 +1191,11 @@ void iguana_bundlestats(struct iguana_info *coin,char *str) } hash2 = block->RO.hash2; } - if ( i == bp->n ) - iguana_bundlefinalize(coin,bp,&coin->MEM,coin->MEMB); + if ( i == bp->n && iguana_bundlefinalize(coin,bp,&coin->MEM,coin->MEMB) == 0 ) + { + //free(bp->speculative); + //bp->speculative = 0; + } } /*if ( bp->speculative != 0 && missing == 0 ) { diff --git a/iguana/iguana_recv.c b/iguana/iguana_recv.c index 4be0267ea..511fbf664 100755 --- a/iguana/iguana_recv.c +++ b/iguana/iguana_recv.c @@ -1238,6 +1238,25 @@ int32_t iguana_reqhdrs(struct iguana_info *coin) return(n); } +int32_t iguana_speculativesearch(struct iguana_info *coin,bits256 hash2) +{ + int32_t i,j; struct iguana_bundle *bp; + for (i=0; ibundlescount; i++) + { + if ( (bp= coin->bundles[i]) != 0 && bp->speculative != 0 ) + { + for (j=0; jn&&jnumspec; j++) + if ( bits256_cmp(hash2,bp->speculative[j]) == 0 ) + { + if ( bp->speculativecache[j] != 0 ) + return(1); + else return(-1); + } + } + } + return(0); +} + 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 n,height = -1; struct iguana_blockreq *req; struct iguana_block *block = 0; @@ -1247,6 +1266,8 @@ int32_t iguana_blockQ(char *argstr,struct iguana_info *coin,struct iguana_bundle //getchar(); return(-1); } + if ( coin->enableCACHE != 0 || iguana_speculativesearch(coin,hash2) > 0 ) + return(0); block = iguana_blockfind(coin,hash2); if ( priority != 0 || block == 0 || iguana_blockstatus(coin,block) == 0 ) {