Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
80fcb45e89
  1. 2
      iguana/iguana777.h
  2. 2
      iguana/iguana_bundles.c
  3. 12
      iguana/iguana_recv.c

2
iguana/iguana777.h

@ -39,7 +39,7 @@ typedef int32_t (*blockhashfunc)(uint8_t *blockhashp,uint8_t *serialized,int32_t
#define IGUANA_MAXPENDHDRS 1 #define IGUANA_MAXPENDHDRS 1
#define _IGUANA_MAXPENDING 3 #define _IGUANA_MAXPENDING 3
#define IGUANA_MINPENDBUNDLES 8 #define IGUANA_MINPENDBUNDLES 8
#define IGUANA_MAXPENDBUNDLES 32 #define IGUANA_MAXPENDBUNDLES 8
#define IGUANA_BUNDLELOOP 77 #define IGUANA_BUNDLELOOP 77
#define IGUANA_RPCPORT 7778 #define IGUANA_RPCPORT 7778
#define IGUANA_MAXRAMCHAINSIZE ((uint64_t)1024L * 1024L * 1024L * 16) #define IGUANA_MAXRAMCHAINSIZE ((uint64_t)1024L * 1024L * 1024L * 16)

2
iguana/iguana_bundles.c

@ -622,7 +622,7 @@ int64_t iguana_bundlecalcs(struct iguana_info *coin,struct iguana_bundle *bp)
printf("iguana_bundlecalcs.(%s) illegal hdrsi.%d bundlei.%d checki.%d\n",fname,hdrsi,bundlei,checki); printf("iguana_bundlecalcs.(%s) illegal hdrsi.%d bundlei.%d checki.%d\n",fname,hdrsi,bundlei,checki);
continue; continue;
} }
if ( 0 && bp->checkedtmp < bp->n && (fp= fopen(fname,"rb")) != 0 ) if ( 1 && bp->checkedtmp < bp->n && (fp= fopen(fname,"rb")) != 0 )
{ {
fseek(fp,0,SEEK_END); fseek(fp,0,SEEK_END);
if ( block->RO.recvlen == 0 ) if ( block->RO.recvlen == 0 )

12
iguana/iguana_recv.c

@ -190,7 +190,7 @@ void iguana_gotblockM(struct iguana_info *coin,struct iguana_peer *addr,struct i
printf("got block that doesnt validate? %s\n",bits256_str(str,origtxdata->block.RO.hash2)); printf("got block that doesnt validate? %s\n",bits256_str(str,origtxdata->block.RO.hash2));
return; return;
} //else printf("validated prev.%s\n",bits256_str(str,origtxdata->block.RO.prev_block)); } //else printf("validated prev.%s\n",bits256_str(str,origtxdata->block.RO.prev_block));
copyflag = 0 * (strcmp(coin->symbol,"BTC") != 0); copyflag = 1 * (strcmp(coin->symbol,"BTC") != 0);
bp = 0, bundlei = -2; bp = 0, bundlei = -2;
if ( copyflag != 0 && recvlen != 0 && ((bp= iguana_bundlefind(coin,&bp,&bundlei,origtxdata->block.RO.hash2)) == 0 || (bp->blocks[bundlei] != 0 && bp->blocks[bundlei]->fpipbits == 0)) ) if ( copyflag != 0 && recvlen != 0 && ((bp= iguana_bundlefind(coin,&bp,&bundlei,origtxdata->block.RO.hash2)) == 0 || (bp->blocks[bundlei] != 0 && bp->blocks[bundlei]->fpipbits == 0)) )
{ {
@ -634,12 +634,12 @@ struct iguana_bundlereq *iguana_recvblockhashes(struct iguana_info *coin,struct
} }
} }
} }
printf("no match to allhashes issue block1\n"); //printf("no match to allhashes issue block1\n");
struct iguana_block *block; struct iguana_block *block;
if ( num == coin->chain->bundlesize+1 && (block= iguana_blockhashset(coin,-1,blockhashes[1],1)) != 0 ) if ( num == coin->chain->bundlesize+1 && (block= iguana_blockhashset(coin,-1,blockhashes[1],1)) != 0 )
{ {
block->blockhashes = blockhashes, req->hashes = 0; block->blockhashes = blockhashes, req->hashes = 0;
printf("set block->blockhashes[%d]\n",num); //printf("set block->blockhashes[%d]\n",num);
} }
if ( (addr= coin->peers.ranked[0]) != 0 ) if ( (addr= coin->peers.ranked[0]) != 0 )
{ {
@ -972,13 +972,13 @@ int32_t iguana_reqhdrs(struct iguana_info *coin)
int32_t i,lag,n = 0; struct iguana_bundle *bp; char hashstr[65]; int32_t i,lag,n = 0; struct iguana_bundle *bp; char hashstr[65];
if ( queue_size(&coin->hdrsQ) == 0 ) if ( queue_size(&coin->hdrsQ) == 0 )
{ {
//if ( iguana_needhdrs(coin) > 0 ) if ( iguana_needhdrs(coin) > 0 )
{ {
for (i=0; i<coin->bundlescount; i++) for (i=0; i<coin->bundlescount; i++)
{ {
if ( (bp= coin->bundles[i]) != 0 && (bp->numhashes < bp->n || i == coin->bundlescount-1) ) if ( (bp= coin->bundles[i]) != 0 && (bp->numhashes < bp->n || i == coin->bundlescount-1) )
{ {
lag = 30; lag = 60;
if ( bp->bundleheight+bp->numhashes < coin->longestchain && time(NULL) > bp->issuetime+lag ) if ( bp->bundleheight+bp->numhashes < coin->longestchain && time(NULL) > bp->issuetime+lag )
{ {
//printf("LAG.%ld hdrsi.%d numhashes.%d:%d needhdrs.%d qsize.%d zcount.%d\n",time(NULL)-bp->hdrtime,i,bp->numhashes,bp->n,iguana_needhdrs(coin),queue_size(&coin->hdrsQ),coin->zcount); //printf("LAG.%ld hdrsi.%d numhashes.%d:%d needhdrs.%d qsize.%d zcount.%d\n",time(NULL)-bp->hdrtime,i,bp->numhashes,bp->n,iguana_needhdrs(coin),queue_size(&coin->hdrsQ),coin->zcount);
@ -1097,7 +1097,7 @@ int32_t iguana_pollQsPT(struct iguana_info *coin,struct iguana_peer *addr)
} }
if ( bp == 0 || z != 0 ) if ( bp == 0 || z != 0 )
{ {
printf("%s request HDR.(%s) numhashes.%d\n",addr!=0?addr->ipaddr:"local",hashstr,bp!=0?bp->numhashes:0); //printf("%s request HDR.(%s) numhashes.%d\n",addr!=0?addr->ipaddr:"local",hashstr,bp!=0?bp->numhashes:0);
iguana_send(coin,addr,serialized,datalen); iguana_send(coin,addr,serialized,datalen);
addr->pendhdrs++; addr->pendhdrs++;
flag++; flag++;

Loading…
Cancel
Save