diff --git a/iguana/iguana777.c b/iguana/iguana777.c index 6168d001a..3b0c81ef6 100755 --- a/iguana/iguana777.c +++ b/iguana/iguana777.c @@ -565,7 +565,7 @@ void iguana_coinloop(void *arg) coin->idletime = (uint32_t)time(NULL); } } - if ( flag == 0 ) + if ( flag == 0 || coin->RTheight >= coin->longestchain-3 ) usleep(coin->polltimeout*1000 + coin->isRT*90000 + (coin->peers.numranked == 0)*1000000); } } diff --git a/iguana/iguana_bundles.c b/iguana/iguana_bundles.c index fe7109336..4303984eb 100755 --- a/iguana/iguana_bundles.c +++ b/iguana/iguana_bundles.c @@ -636,8 +636,8 @@ int32_t iguana_bundlehdr(struct iguana_info *coin,struct iguana_bundle *bp,int32 if ( bp == coin->current && bp->speculative != 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,30) > 0 ) - iguana_bundleissuemissing(coin,bp,missings,0); + if ( iguana_blocksmissing(coin,&avail,missings,0,bp,0,7) > 0 ) + iguana_bundleissuemissing(coin,bp,missings,3); } queue_enqueue("hdrsQ",&coin->hdrsQ,queueitem(bits256_str(str,bp->hashes[0])),1); } @@ -921,14 +921,14 @@ double iguana_bundlemissings(struct iguana_info *coin,struct iguana_bundle *bp,d else max = bp->origmissings; if ( coin->current != 0 ) { - if ( (dist= bp->hdrsi - coin->current->hdrsi) < 3 ) + if ( (dist= bp->hdrsi - coin->current->hdrsi) < coin->MAXBUNDLES ) { if ( bp->numcached > bp->n - (coin->MAXBUNDLES - dist) ) priority += 1 + (bp == coin->current); if ( queue_size(&coin->priorityQ) < (2 * bp->n)/(dist+1) ) { //printf("[%d] dist.%d numcached.%d priority.%d\n",bp->hdrsi,dist,bp->numcached,priority); - iguana_bundleissuemissing(coin,bp,missings,3); + iguana_bundleissuemissing(coin,bp,missings,((rand() % 10) == 0)*3); } } } diff --git a/iguana/iguana_recv.c b/iguana/iguana_recv.c index f3a5e19a0..5c0ae4c7b 100755 --- a/iguana/iguana_recv.c +++ b/iguana/iguana_recv.c @@ -936,21 +936,21 @@ struct iguana_bundlereq *iguana_recvblockhashes(struct iguana_info *coin,struct struct iguana_bundlereq *iguana_recvblock(struct iguana_info *coin,struct iguana_peer *addr,struct iguana_bundlereq *req,struct iguana_block *origblock,int32_t numtx,int32_t datalen,int32_t recvlen,int32_t *newhwmp) { - struct iguana_bundle *bp=0,*prev; int32_t numsaved=0,bundlei = -2; struct iguana_block *block,*tmpblock; char str[65]; + struct iguana_bundle *bp=0,*prev; int32_t numsaved=0,bundlei = -2; struct iguana_block *block,*tmpblock; char str[65]; bits256 hash2; if ( (bp= iguana_bundleset(coin,&block,&bundlei,origblock)) != 0 && bp == coin->current && block != 0 && bp->speculative != 0 && bundlei >= 0 ) { if ( bp->speculative != 0 && bp->numspec <= bundlei ) { bp->speculative[bundlei] = block->RO.hash2; bp->numspec = bundlei+1; - /*while ( bundlei < bp->n && block != 0 && bp->bundleheight+bundlei == coin->blocks.hwmchain.height+1 && _iguana_chainlink(coin,block) != 0 ) - { - printf("MAIN.%d ",bp->bundleheight+bundlei); - bundlei++; - block = iguana_bundleblock(coin,&hash2,bp,bundlei); - }*/ - printf("autoadd [%d:%d]\n",bp->hdrsi,bundlei); } + while ( bundlei < bp->n && block != 0 && bp->bundleheight+bundlei == coin->blocks.hwmchain.height+1 && _iguana_chainlink(coin,block) != 0 ) + { + //printf("MAIN.%d ",bp->bundleheight+bundlei); + bundlei++; + block = iguana_bundleblock(coin,&hash2,bp,bundlei); + } + //printf("autoadd [%d:%d]\n",bp->hdrsi,bundlei); } if ( bp != 0 ) { diff --git a/iguana/main.c b/iguana/main.c index 12b37b83d..8ded83722 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("{\"prefetchlag\":13,\"startpend\":256,\"endpend\":128,\"userhome\":\"/Users/jimbolaptop/Library/Application Support\",\"agent\":\"iguana\",\"method\":\"addcoin\",\"services\":128,\"maxpeers\":118,\"newcoin\":\"BTCD\",\"active\":1,\"numhelpers\":8,\"poll\":1}"),0,myinfo->rpcport)) != 0 ) + if ( 1 && (str= SuperNET_JSON(myinfo,cJSON_Parse("{\"VALIDATE\":1,\"prefetchlag\":13,\"startpend\":256,\"endpend\":128,\"userhome\":\"/Users/jimbolaptop/Library/Application Support\",\"agent\":\"iguana\",\"method\":\"addcoin\",\"services\":128,\"maxpeers\":118,\"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 )