diff --git a/iguana/iguana_bundles.c b/iguana/iguana_bundles.c index a6fcdcc81..6fd0f75b6 100755 --- a/iguana/iguana_bundles.c +++ b/iguana/iguana_bundles.c @@ -875,7 +875,7 @@ int32_t iguana_cacheprocess(struct iguana_info *coin,struct iguana_bundle *bp,in double iguana_bundlemissings(struct iguana_info *coin,struct iguana_bundle *bp,double aveduration,int32_t lag) { - uint8_t missings[IGUANA_MAXBUNDLESIZE/8+1]; int32_t i,tmp,dist=0,missing,priority,avail,n=0,max; double aveduplicates; + uint8_t missings[IGUANA_MAXBUNDLESIZE/8+1]; int32_t i,tmp,dist=0,missing,priority,avail,n=0,max; double aveduplicates; bits256 hash2; missing = iguana_blocksmissing(coin,&avail,missings,0,bp,0,lag); priority = (strcmp("BTC",coin->symbol) != 0) * 2; lag = IGUANA_DEFAULTLAG; @@ -891,9 +891,21 @@ double iguana_bundlemissings(struct iguana_info *coin,struct iguana_bundle *bp,d } if ( queue_size(&coin->priorityQ) < (3 * bp->n)/(dist+1) ) { + printf("[%d] dist.%d numcached.%d priority.%d\n",bp->hdrsi,dist,bp->numcached,priority); for (i=0; in; i++) - if ( GETBIT(missings,i) != 0 && bits256_nonz(bp->hashes[i]) != 0 ) - iguana_blockQ("missings",coin,bp,i,bp->hashes[i],1); + { + if ( bits256_nonz(bp->hashes[i]) != 0 ) + hash2 = bp->hashes[i]; + else if ( bits256_nonz(bp->hashes[i]) != 0 && bp->speculative != 0 ) + hash2 = bp->speculative[i]; + else continue; + if ( GETBIT(missings,i) != 0 && bits256_nonz(hash2) != 0 ) + { + if ( bp == coin->current ) + printf("issue.[%d:%d]\n",bp->hdrsi,i); + iguana_blockQ("missings",coin,bp,i,hash2,1); + } + } } } if ( bp->durationscount != 0 ) diff --git a/iguana/iguana_recv.c b/iguana/iguana_recv.c index b204fe95a..609e27c7c 100755 --- a/iguana/iguana_recv.c +++ b/iguana/iguana_recv.c @@ -949,9 +949,9 @@ struct iguana_bundlereq *iguana_recvblock(struct iguana_info *coin,struct iguana } fprintf(stderr,"%s [%d:%d] block.%x | s.%d r.%d copy.%d\n",bits256_str(str,origblock->RO.hash2),bp!=0?bp->hdrsi:-1,bundlei,block->fpipbits,numsaved,numrecv,req->copyflag); } - if ( 1 && bundlei == 1 && bp != 0 && bp->numhashes < bp->n && coin->enableCACHE != 0 && bp->speculative == 0 ) + if ( 1 && bundlei == 1 && bp != 0 && bp->numhashes < bp->n && coin->enableCACHE != 0 && bp->speculative == 0 && bp == coin->current ) { - //printf("reissue hdrs request for [%d]\n",bp->hdrsi); + printf("reissue hdrs request for [%d]\n",bp->hdrsi); queue_enqueue("hdrsQ",&coin->hdrsQ,queueitem(bits256_str(str,bp->hashes[0])),1); } if ( (block= iguana_blockhashset(coin,-1,origblock->RO.hash2,1)) != 0 ) diff --git a/iguana/iguana_unspents.c b/iguana/iguana_unspents.c index e84cee3fd..4656f81b4 100755 --- a/iguana/iguana_unspents.c +++ b/iguana/iguana_unspents.c @@ -752,12 +752,12 @@ int32_t iguana_spendvectors(struct iguana_info *coin,struct iguana_bundle *bp) printf("unexpected spendbp: height.%d bp.[%d] U%d <- S%d.[%d] [ext.%d %s prev.%d]\n",bp->bundleheight+i,spentbp->hdrsi,spent_unspentind,spendind,bp->hdrsi,s->external,bits256_str(str,prevhash),s->prevout); errs++; } - if ( coin->PREFETCHLAG != 0 && now >= spentbp->lastprefetch+coin->PREFETCHLAG ) + /*if ( coin->PREFETCHLAG != 0 && now >= spentbp->lastprefetch+coin->PREFETCHLAG ) { printf("prefetch[%d] from.[%d] lag.%d\n",spentbp->hdrsi,bp->hdrsi,now - spentbp->lastprefetch); iguana_ramchain_prefetch(coin,&spentbp->ramchain); spentbp->lastprefetch = now; - } + }*/ spentU = (void *)(long)((long)spentbp->ramchain.H.data + spentbp->ramchain.H.data->Uoffset); u = &spentU[spent_unspentind]; if ( (spent_pkind= u->pkind) != 0 && spent_pkind < spentbp->ramchain.H.data->numpkinds ) diff --git a/iguana/main.c b/iguana/main.c index e248f303c..1cc04ebf8 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -1191,7 +1191,7 @@ void iguana_main(void *arg) if ( 1 ) { sleep(1); - if ( 1 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"startpend\":64,\"endpend\":64,\"userhome\":\"/Users/jimbolaptop/Library/Application Support\",\"agent\":\"iguana\",\"method\":\"addcoin\",\"services\":128,\"maxpeers\":512,\"newcoin\":\"BTCD\",\"active\":1,\"numhelpers\":8,\"poll\":1}"),0,myinfo->rpcport)) != 0 ) + if ( 1 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"startpend\":512,\"endpend\":512,\"userhome\":\"/Users/jimbolaptop/Library/Application Support\",\"agent\":\"iguana\",\"method\":\"addcoin\",\"services\":128,\"maxpeers\":512,\"newcoin\":\"BTCD\",\"active\":1,\"numhelpers\":8,\"poll\":1}"),0,myinfo->rpcport)) != 0 ) { free(str); if ( 0 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"userhome\":\"/Users/jimbolaptop/Library/Application Support\",\"agent\":\"iguana\",\"method\":\"addcoin\",\"services\":1024,\"maxpeers\":256,\"newcoin\":\"BTCD\",\"active\":1}"),0,myinfo->rpcport)) != 0 )