Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
b7b3df2b6e
  1. 21
      iguana/iguana_bundles.c
  2. 2
      iguana/iguana_recv.c

21
iguana/iguana_bundles.c

@ -898,9 +898,9 @@ int32_t iguana_cacheprocess(struct iguana_info *coin,struct iguana_bundle *bp,in
return(-1);
}
int32_t iguana_bundlemissings(struct iguana_info *coin,struct iguana_bundle *bp,int32_t capacity,int32_t lag)
double iguana_bundlemissings(struct iguana_info *coin,struct iguana_bundle *bp,double aveduration,int32_t lag)
{
uint8_t missings[IGUANA_MAXBUNDLESIZE/8+1]; int32_t i,tmp,dist=0,missing,priority,avail,n=0,max; double aveduration,aveduplicates;
uint8_t missings[IGUANA_MAXBUNDLESIZE/8+1]; int32_t i,tmp,dist=0,missing,priority,avail,n=0,max; double aveduplicates;
missing = iguana_blocksmissing(coin,&avail,missings,0,bp,0,lag);
priority = (strcmp("BTC",coin->symbol) != 0) * 2;
lag = IGUANA_DEFAULTLAG;
@ -929,25 +929,21 @@ int32_t iguana_bundlemissings(struct iguana_info *coin,struct iguana_bundle *bp,
else aveduplicates = 3 * aveduration;
if ( (rand() % 1000) == 0 )
printf("priority.%d [%d] dist.%d durations %.2f vs %.2f counts[%d %d] \n",priority,bp->hdrsi,dist,aveduration,aveduplicates,(int32_t)bp->durationscount,bp->duplicatescount);
lag = 3 * aveduration;
}
//if ( bp->missingstime == 0 || bp->numissued < bp->n )//|| (bp == coin->current && time(NULL) > bp->missingstime+lag) ) //
{
if ( aveduration != 0. )
lag = 3 * aveduration;
if ( (n= iguana_bundlerequests(coin,missings,&bp->origmissings,&tmp,bp,lag,priority)) > 0 )
{
//printf("bundle.[%d] numissued.%d missings.%d n.%d capacity %d -> %d\n",bp->hdrsi,bp->numissued,bp->origmissings,n,capacity,capacity-n);
bp->numissued += n;
capacity -= n;
bp->missingstime = (uint32_t)time(NULL);
}
}
return(capacity);
return(aveduration);
}
void iguana_bundlestats(struct iguana_info *coin,char *str,int32_t lag)
{
int32_t i,n,m,j,numv,count,starti,lasti,pending,capacity,dispflag,numutxo,numbalances,numrecv,done,numhashes,numcached,numsaved,numemit; struct iguana_block *block; bits256 hash2;
int64_t spaceused=0,estsize = 0; struct iguana_bundle *currentbp,*lastbp,*bp,*lastpending = 0,*firstgap = 0;uint32_t now;
int64_t spaceused=0,estsize = 0; struct iguana_bundle *currentbp,*lastbp,*bp,*lastpending = 0,*firstgap = 0; uint32_t now; double aveduration,recentduration = 0.;
now = (uint32_t)time(NULL);
dispflag = 1;//(rand() % 1000) == 0;
numrecv = numhashes = numcached = numsaved = numemit = done = numutxo = numbalances = 0;
@ -983,7 +979,10 @@ void iguana_bundlestats(struct iguana_info *coin,char *str,int32_t lag)
else
{
if ( bp->hdrsi >= starti && bp->hdrsi < lasti )
capacity = iguana_bundlemissings(coin,bp,capacity,lag);
{
if ( (aveduration= iguana_bundlemissings(coin,bp,recentduration,lag)) != 0 )
dxblend(&recentduration,aveduration,.5);
}
if ( coin->enableCACHE != 0 )
{
for (j=0; j<bp->n; j++)

2
iguana/iguana_recv.c

@ -926,7 +926,7 @@ 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; int32_t width,numsaved=0,bundlei = -2; struct iguana_block *block,*tmpblock,*prev; char str[65];
struct iguana_bundle *bp=0; int32_t numsaved=0,bundlei = -2; struct iguana_block *block,*tmpblock; char str[65];
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 )

Loading…
Cancel
Save