Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
0ca41038ce
  1. 10
      iguana/iguana777.h
  2. 1
      iguana/iguana_bundles.c
  3. 8
      iguana/iguana_ramchain.c
  4. 22
      iguana/iguana_recv.c

10
iguana/iguana777.h

@ -35,9 +35,9 @@ typedef int32_t (*blockhashfunc)(uint8_t *blockhashp,uint8_t *serialized,int32_t
#define IGUANA_HEADPERCENTAGE .00777
#define IGUANA_TAILPERCENTAGE 1.0
#define IGUANA_MAXPENDHDRS 1
#define _IGUANA_MAXPENDING 3 //64
#define _IGUANA_MAXPENDING 8 //64
#define _IGUANA_MAXBUNDLES 8
#define IGUANA_BUNDLELOOP 128
#define IGUANA_BUNDLELOOP 64
#define IGUANA_RPCPORT 7778
#define IGUANA_MAXRAMCHAINSIZE ((uint64_t)1024L * 1024L * 1024L * 16)
@ -416,7 +416,7 @@ struct iguana_bundle
struct queueitem DL; struct iguana_info *coin; struct iguana_bundle *nextbp;
struct iguana_bloom16 bloom; uint32_t rawscriptspace;
uint32_t issuetime,hdrtime,emitfinish,mergefinish,purgetime,queued,startutxo,utxofinish;
int32_t numhashes,numrecv,numsaved,numcached,rank;
int32_t numhashes,numrecv,numsaved,numcached,rank,generrs;
int32_t minrequests,n,hdrsi,bundleheight,numtxids,numspends,numunspents,numspec;
double avetime,threshold,metric; uint64_t datasize,estsize;
struct iguana_block *blocks[IGUANA_MAXBUNDLESIZE]; uint32_t issued[IGUANA_MAXBUNDLESIZE];
@ -468,8 +468,8 @@ struct iguana_info
double parsemillis,avetime; uint32_t Launched[8],Terminated[8];
portable_mutex_t peers_mutex,blocks_mutex;
portable_mutex_t scripts_mutex[2]; FILE *scriptsfp[2]; void *scriptsptr[2]; long scriptsfilesize[2];
struct scriptinfo *scriptstable[2];
struct iguana_bundle *bundles[IGUANA_MAXBUNDLES];
//struct scriptinfo *scriptstable[2];
struct iguana_bundle *bundles[IGUANA_MAXBUNDLES],*current;
int32_t numremain,numpendings,zcount,recvcount,bcount,pcount,lastbundle;
uint32_t recvtime,hdrstime,backstoptime,lastbundletime,numreqsent,numbundlesQ,lastbundleitime;
double backstopmillis; bits256 backstophash2;

1
iguana/iguana_bundles.c

@ -490,6 +490,7 @@ void iguana_bundlestats(struct iguana_info *coin,char *str)
tmp = (difft.millis * 1000000);
tmp %= 1000000000;
difft.millis = ((double)tmp / 1000000.);
coin->current = firstgap;
sprintf(str,"1st.%d N[%d] Q.%d h.%d r.%d c.%d:%d:%d s.%d d.%d E.%d:%d M.%d L.%d est.%d %s %d:%02d:%02d %03.3f peers.%d/%d Q.(%d %d)",firstgap!=0?firstgap->hdrsi:0,count,coin->numbundlesQ,numhashes,coin->blocksrecv,coin->numcached,numcached,coin->cachefreed,numsaved,done,numemit,coin->numreqsent,coin->blocks.hwmchain.height,coin->longestchain,coin->MAXBUNDLES,mbstr(str2,estsize),(int32_t)difft.x/3600,(int32_t)(difft.x/60)%60,(int32_t)difft.x%60,difft.millis,p,coin->MAXPEERS,queue_size(&coin->priorityQ),queue_size(&coin->blocksQ));
//sprintf(str+strlen(str),"%s.%-2d %s time %.2f files.%d Q.%d %d\n",coin->symbol,flag,str,(double)(time(NULL)-coin->starttime)/60.,coin->peers.numfiles,queue_size(&coin->priorityQ),queue_size(&coin->blocksQ));
if ( time(NULL) > lastdisp+10 )

8
iguana/iguana_ramchain.c

@ -2678,9 +2678,9 @@ int32_t iguana_bundlesaveHT(struct iguana_info *coin,struct OS_memspace *mem,str
{
char str[65],str2[65]; printf("%s d.%d ht.%d %s saved lag.%d elapsed.%ld\n",bits256_str(str2,newchain.H.data->sha256),depth,dest->height,mbstr(str,dest->H.data->allocsize),now-starttime,time(NULL)-now);
retval = 0;
}
} else bp->generrs++;
iguana_bundlemapfree(mem,&HASHMEM,ipbits,ptrs,filesizes,num,R,bp->n);
if ( retval == 0 )
if ( retval == 0 || bp->generrs > 3 )
{
//printf("delete %d files hdrs.%d retval.%d\n",num,bp->hdrsi,retval);
for (j=0; j<num; j++)
@ -2689,10 +2689,10 @@ int32_t iguana_bundlesaveHT(struct iguana_info *coin,struct OS_memspace *mem,str
coin->peers.numfiles -= OS_removefile(fname,0);
else printf("error removing.(%s)\n",fname);
}
bp->ramchain = newchain;
iguana_bundleload(coin,bp);
}
iguana_ramchain_free(dest,0);
bp->ramchain = newchain;
iguana_bundleload(coin,bp);
return(retval);
}

22
iguana/iguana_recv.c

@ -385,7 +385,7 @@ int32_t iguana_bundleiters(struct iguana_info *coin,struct iguana_bundle *bp,int
if ( (block= bp->blocks[i]) != 0 && block->numrequests == 0 && block->mainchain != 0 )
{
block->numrequests++;
iguana_blockQ(coin,bp,i,block->RO.hash2,bp->hdrsi == 0);
iguana_blockQ(coin,bp,i,block->RO.hash2,bp == coin->current);
//printf("%d ",i);
}
}
@ -802,7 +802,7 @@ int32_t iguana_blockQ(struct iguana_info *coin,struct iguana_bundle *bp,int32_t
{
if ( block != 0 && bits256_cmp(coin->APIblockhash,hash2) != 0 )
{
if ( block->fpipbits != 0 || block->queued != 0 || block->issued > time(NULL)-10 )
if ( block->fpipbits != 0 || block->queued != 0 || block->issued > time(NULL)-60 )
return(0);
}
if ( priority != 0 )
@ -812,7 +812,7 @@ int32_t iguana_blockQ(struct iguana_info *coin,struct iguana_bundle *bp,int32_t
{
if ( bp != 0 && bundlei >= 0 && bundlei < bp->n )
{
if ( bp->issued[bundlei] == 0 || time(NULL) > bp->issued[bundlei]+13 )
if ( bp->issued[bundlei] == 0 || time(NULL) > bp->issued[bundlei]+30 )
{
bp->issued[bundlei] = (uint32_t)time(NULL);
if ( bp->bundleheight >= 0 )
@ -1007,6 +1007,22 @@ int32_t iguana_pollQsPT(struct iguana_info *coin,struct iguana_peer *addr)
int32_t iguana_reqblocks(struct iguana_info *coin)
{
int32_t hdrsi,lflag,bundlei,flag = 0; bits256 hash2; struct iguana_block *next,*block; struct iguana_bundle *bp;
if ( queue_size(&coin->priorityQ) == 0 && (bp= coin->current) != 0 )
{
for (bundlei=0; bundlei<bp->n; bundlei++)
if ( (block= bp->blocks[bundlei]) != 0 && ((block->fpipbits == 0 && block->queued == 0) || time(NULL) > block->issued+30) )
{
printf("%d ",bundlei);
block->fpipbits = 0;
block->queued = 0;
block->issued = 0;
bp->issued[bundlei] = 0;
iguana_blockQ(coin,bp,bundlei,block->RO.hash2,1);
flag++;
}
if ( flag != 0 )
printf("issued %d priority blocks for current.[%d]\n",flag,bp->hdrsi);
}
hdrsi = (coin->blocks.hwmchain.height+1) / coin->chain->bundlesize;
if ( (bp= coin->bundles[hdrsi]) != 0 )
{

Loading…
Cancel
Save