diff --git a/iguana/iguana_recv.c b/iguana/iguana_recv.c index 3fcf53a51..a3ba8ab0c 100755 --- a/iguana/iguana_recv.c +++ b/iguana/iguana_recv.c @@ -702,29 +702,32 @@ struct iguana_bundlereq *iguana_recvblock(struct iguana_info *coin,struct iguana { block->RO.txn_count = req->numtx; //block->RO.recvlen = recvlen; - if ( req->copyflag != 0 && block->queued == 0 && bp != 0 ) + if ( req->copyflag != 0 ) { - char str[65]; fprintf(stderr,"req.%p %s copyflag.%d %d data %d %d\n",req,bits256_str(str,block->RO.hash2),req->copyflag,block->height,req->recvlen,recvlen); - coin->numcached++; - block->queued = 1; - queue_enqueue("cacheQ",&coin->cacheQ,&req->DL,0); - return(0); - } - else - { - if ( (block= iguana_blockhashset(coin,-1,origblock->RO.hash2,1)) != 0 ) + if ( block->queued == 0 && bp != 0 ) { - if ( block != origblock ) + char str[65]; fprintf(stderr,"req.%p %s copyflag.%d %d data %d %d\n",req,bits256_str(str,block->RO.hash2),req->copyflag,block->height,req->recvlen,recvlen); + coin->numcached++; + block->queued = 1; + queue_enqueue("cacheQ",&coin->cacheQ,&req->DL,0); + return(0); + } + else + { + if ( (block= iguana_blockhashset(coin,-1,origblock->RO.hash2,1)) != 0 ) { - iguana_blockcopy(coin,block,origblock); - coin->numcached++; - if ( block->req == 0 ) + if ( block != origblock ) { - block->req = req; - req = 0; - } else printf("already have cache entry.(%s)\n",bits256_str(str,origblock->RO.hash2)); - //fprintf(stderr,"bundleset block.%p vs origblock.%p prev.%d bits.%x fpos.%ld\n",block,origblock,bits256_nonz(prevhash2),block->fpipbits,block->fpos); - } else printf("got origblock.%s to cache\n",bits256_str(str,origblock->RO.hash2)); + iguana_blockcopy(coin,block,origblock); + coin->numcached++; + if ( block->req == 0 ) + { + block->req = req; + req = 0; + } else printf("already have cache entry.(%s)\n",bits256_str(str,origblock->RO.hash2)); + //fprintf(stderr,"bundleset block.%p vs origblock.%p prev.%d bits.%x fpos.%ld\n",block,origblock,bits256_nonz(prevhash2),block->fpipbits,block->fpos); + } else printf("got origblock.%s to cache\n",bits256_str(str,origblock->RO.hash2)); + } } } //printf("datalen.%d ipbits.%x\n",datalen,req->ipbits); diff --git a/iguana/main.c b/iguana/main.c index 7e19f49fd..5db5cb16b 100755 --- a/iguana/main.c +++ b/iguana/main.c @@ -1117,7 +1117,7 @@ void iguana_main(void *arg) sleep(1); char *str; //iguana_launchcoin(MYINFO.rpcsymbol,cJSON_Parse("{}")); - if ( 1 && (str= SuperNET_JSON(&MYINFO,cJSON_Parse("{\"userhome\":\"/Users/jimbolaptop/Library/Application Support\",\"agent\":\"iguana\",\"method\":\"addcoin\",\"services\":128,\"maxpeers\":64,\"newcoin\":\"BTCD\",\"active\":1,\"numhelpers\":1,\"poll\":1,\"startpend\":1024,\"endpend\":1024,\"cache\":1}"),0)) != 0 ) + if ( 1 && (str= SuperNET_JSON(&MYINFO,cJSON_Parse("{\"userhome\":\"/Users/jimbolaptop/Library/Application Support\",\"agent\":\"iguana\",\"method\":\"addcoin\",\"services\":128,\"maxpeers\":64,\"newcoin\":\"BTC\",\"active\":1,\"numhelpers\":1,\"poll\":1,\"startpend\":2,\"endpend\":2,\"cache\":0}"),0)) != 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)) != 0 )