Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
2ceda89e96
  1. 4
      iguana/iguana777.h
  2. 10
      iguana/iguana_bundles.c
  3. 11
      iguana/iguana_recv.c

4
iguana/iguana777.h

@ -38,7 +38,7 @@ typedef int32_t (*blockhashfunc)(uint8_t *blockhashp,uint8_t *serialized,int32_t
#define IGUANA_TAILPERCENTAGE 1.0 #define IGUANA_TAILPERCENTAGE 1.0
#define IGUANA_MAXPENDHDRS 1 #define IGUANA_MAXPENDHDRS 1
#define _IGUANA_MAXPENDING 7 #define _IGUANA_MAXPENDING 7
#define IGUANA_MINPENDBUNDLES 64 #define IGUANA_MINPENDBUNDLES 8
#define IGUANA_MAXPENDBUNDLES 64 #define IGUANA_MAXPENDBUNDLES 64
#define IGUANA_BUNDLELOOP 10000 #define IGUANA_BUNDLELOOP 10000
#define IGUANA_RPCPORT 7778 #define IGUANA_RPCPORT 7778
@ -471,7 +471,7 @@ struct iguana_info
portable_mutex_t peers_mutex,blocks_mutex; portable_mutex_t peers_mutex,blocks_mutex;
portable_mutex_t scripts_mutex[2]; FILE *scriptsfp[2]; void *scriptsptr[2]; long scriptsfilesize[2]; portable_mutex_t scripts_mutex[2]; FILE *scriptsfp[2]; void *scriptsptr[2]; long scriptsfilesize[2];
//struct scriptinfo *scriptstable[2]; //struct scriptinfo *scriptstable[2];
struct iguana_bundle *bundles[IGUANA_MAXBUNDLES],*current; struct iguana_bundle *bundles[IGUANA_MAXBUNDLES],*current,*lastpending;
int32_t numremain,numpendings,zcount,recvcount,bcount,pcount,lastbundle,numsaved; int32_t numremain,numpendings,zcount,recvcount,bcount,pcount,lastbundle,numsaved;
uint32_t recvtime,hdrstime,backstoptime,lastbundletime,numreqsent,numbundlesQ,lastbundleitime; uint32_t recvtime,hdrstime,backstoptime,lastbundletime,numreqsent,numbundlesQ,lastbundleitime;
double backstopmillis; bits256 backstophash2; double backstopmillis; bits256 backstophash2;

10
iguana/iguana_bundles.c

@ -448,13 +448,13 @@ static int32_t revsortds(double *buf,uint32_t num,int32_t size)
void iguana_bundlestats(struct iguana_info *coin,char *str) void iguana_bundlestats(struct iguana_info *coin,char *str)
{ {
static uint32_t lastdisp; static uint32_t lastdisp;
int32_t i,n,m,count,dispflag,numrecv,done,numhashes,numcached,numsaved,numemit; int32_t i,n,m,count,pending,dispflag,numrecv,done,numhashes,numcached,numsaved,numemit;
int64_t estsize = 0; struct iguana_bundle *bp,*firstgap = 0; double *sortbuf; struct iguana_peer *addr; int64_t estsize = 0; struct iguana_bundle *bp,*lastpending = 0,*firstgap = 0; double *sortbuf; struct iguana_peer *addr;
dispflag = (rand() % 1000) == 0; dispflag = (rand() % 1000) == 0;
numrecv = numhashes = numcached = numsaved = numemit = done = 0; numrecv = numhashes = numcached = numsaved = numemit = done = 0;
count = coin->bundlescount; count = coin->bundlescount;
sortbuf = calloc(count,sizeof(*sortbuf)*2); sortbuf = calloc(count,sizeof(*sortbuf)*2);
for (i=n=m=0; i<count; i++) for (i=n=m=pending=0; i<count; i++)
{ {
if ( (bp= coin->bundles[i]) != 0 ) if ( (bp= coin->bundles[i]) != 0 )
{ {
@ -475,6 +475,8 @@ void iguana_bundlestats(struct iguana_info *coin,char *str)
{ {
if ( firstgap == 0 ) if ( firstgap == 0 )
firstgap = bp; firstgap = bp;
else if ( pending++ == coin->MAXPENDING )
lastpending = bp;
sortbuf[m*2] = bp->metric; sortbuf[m*2] = bp->metric;
sortbuf[m*2 + 1] = i; sortbuf[m*2 + 1] = i;
m++; m++;
@ -507,6 +509,8 @@ void iguana_bundlestats(struct iguana_info *coin,char *str)
tmp %= 1000000000; tmp %= 1000000000;
difft.millis = ((double)tmp / 1000000.); difft.millis = ((double)tmp / 1000000.);
coin->current = firstgap; coin->current = firstgap;
if ( lastpending != 0 )
coin->lastpending = lastpending;
coin->numsaved = numsaved; coin->numsaved = numsaved;
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,"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)); //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));

11
iguana/iguana_recv.c

@ -452,10 +452,11 @@ int32_t iguana_bundlekick(struct iguana_info *coin,struct iguana_bundle *bp,int3
int32_t iguana_bundleiters(struct iguana_info *coin,struct iguana_bundle *bp,int32_t timelimit) int32_t iguana_bundleiters(struct iguana_info *coin,struct iguana_bundle *bp,int32_t timelimit)
{ {
int32_t i,r,range,starti,numhashes,issued,valid,max,counter = 0; struct iguana_block *block; double endmillis,width; struct iguana_bundle *prevbp; uint32_t starttime; int32_t i,r,range,starti,lasti,numhashes,issued,valid,max,counter = 0; struct iguana_block *block; double endmillis,width; struct iguana_bundle *prevbp; uint32_t starttime;
if ( (range= coin->peers.numranked) > coin->MAXBUNDLES ) if ( (range= coin->peers.numranked) > coin->MAXBUNDLES )
range = coin->MAXBUNDLES; range = coin->MAXBUNDLES;
starti = coin->current == 0 ? 0 : coin->current->hdrsi; starti = coin->current == 0 ? 0 : coin->current->hdrsi;
lasti = coin->lastpending == 0 ? coin->bundlescount-1 : coin->lastpending->hdrsi;
coin->numbundlesQ--; coin->numbundlesQ--;
for (i=numhashes=0; i<bp->n; i++) for (i=numhashes=0; i<bp->n; i++)
numhashes += bits256_nonz(bp->hashes[i]); numhashes += bits256_nonz(bp->hashes[i]);
@ -533,7 +534,7 @@ int32_t iguana_bundleiters(struct iguana_info *coin,struct iguana_bundle *bp,int
return(0); return(0);
} }
//printf("BUNDLEITERS.%d\n",bp->hdrsi); //printf("BUNDLEITERS.%d\n",bp->hdrsi);
if ( bp->hdrsi < starti + range ) if ( bp->hdrsi <= lasti && coin->lastpending != 0 )
{ {
for (i=0; i<bp->n; i++) for (i=0; i<bp->n; i++)
{ {
@ -547,7 +548,7 @@ int32_t iguana_bundleiters(struct iguana_info *coin,struct iguana_bundle *bp,int
} }
else else
{ {
iguana_bundleQ(coin,bp,counter == 0 ? bp->n*5 : bp->n*2); iguana_bundleQ(coin,bp,1000);
return(0); return(0);
} }
//printf("initial requests for hdrs.%d\n",bp->hdrsi); //printf("initial requests for hdrs.%d\n",bp->hdrsi);
@ -579,7 +580,7 @@ int32_t iguana_bundleiters(struct iguana_info *coin,struct iguana_bundle *bp,int
} }
else else
{ {
r = (rand() % 4); r = (rand() % 16);
if ( starti+r < coin->bundlescount && coin->bundles[starti+r] != 0 ) if ( starti+r < coin->bundlescount && coin->bundles[starti+r] != 0 )
iguana_bundlekick(coin,coin->bundles[starti+r],starti+r,coin->bundles[starti+r]->n); iguana_bundlekick(coin,coin->bundles[starti+r],starti+r,coin->bundles[starti+r]->n);
} }
@ -599,7 +600,7 @@ int32_t iguana_bundleiters(struct iguana_info *coin,struct iguana_bundle *bp,int
//printf("(%x:%x) ",(uint32_t)block->RO.hash2.ulongs[3],(uint32_t)bp->hashes[i].ulongs[3]); //printf("(%x:%x) ",(uint32_t)block->RO.hash2.ulongs[3],(uint32_t)bp->hashes[i].ulongs[3]);
if ( block->fpipbits == 0 || (bp->bundleheight+i > 0 && bits256_nonz(block->RO.prev_block) == 0) || iguana_blockvalidate(coin,&valid,block,1) < 0 ) if ( block->fpipbits == 0 || (bp->bundleheight+i > 0 && bits256_nonz(block->RO.prev_block) == 0) || iguana_blockvalidate(coin,&valid,block,1) < 0 )
{ {
//char str[65]; printf(">>>>>>> ipbits.%x null prevblock error at ht.%d patch.(%s) and reissue\n",block->fpipbits,bp->bundleheight+i,bits256_str(str,block->RO.prev_block)); char str[65]; printf(">>>>>>> ipbits.%x null prevblock error at ht.%d patch.(%s) and reissue\n",block->fpipbits,bp->bundleheight+i,bits256_str(str,block->RO.prev_block));
block->queued = 0; block->queued = 0;
block->fpipbits = 0; block->fpipbits = 0;
block->issued = 0; block->issued = 0;

Loading…
Cancel
Save