Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
2bbe7fc396
  1. 15
      iguana/iguana_bundles.c
  2. 31
      iguana/iguana_init.c

15
iguana/iguana_bundles.c

@ -521,7 +521,7 @@ int32_t iguana_sendhashes(struct iguana_info *coin,struct iguana_peer *addr,int3
coin->numreqsent += n;
addr->pendblocks += n;
addr->pendtime = (uint32_t)time(NULL);
printf("sendhashes[%d] -> %s\n",n,addr->ipaddr);
//printf("sendhashes[%d] -> %s\n",n,addr->ipaddr);
} else n = 0;
free(serialized);
}
@ -954,9 +954,9 @@ void iguana_unstickhdr(struct iguana_info *coin,struct iguana_bundle *bp,int32_t
}
}
double iguana_bundlemissings(struct iguana_info *coin,double mult,struct iguana_bundle *bp,double aveduration)
double iguana_bundlemissings(struct iguana_info *coin,struct iguana_bundle *bp,double aveduration)
{
uint8_t missings[IGUANA_MAXBUNDLESIZE/8+1]; int32_t lag,tmp,dist=0,missing,priority,avail,n=0,max; double aveduplicates; //bits256 hash2;
uint8_t missings[IGUANA_MAXBUNDLESIZE/8+1]; int32_t lag,tmp,dist=0,missing,priority,avail,n=0,max; double aveduplicates,mult; //bits256 hash2;
missing = iguana_blocksmissing(coin,&avail,missings,0,mult,bp,0);
priority = (strcmp("BTC",coin->symbol) != 0) * 2;
lag = IGUANA_DEFAULTLAG;
@ -970,11 +970,12 @@ double iguana_bundlemissings(struct iguana_info *coin,double mult,struct iguana_
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);
}
if ( aveduration != 0. )
lag = ((bp == coin->current) ? .5 : 5) * aveduration + 3;
mult = ((bp == coin->current) ? 1. : 5.);
else mult = 3.;
if ( bp->numissued < bp->n )
max = bp->numissued;
else max = bp->origmissings;
if ( coin->current != 0 )
/*if ( coin->current != 0 )
{
if ( (dist= bp->hdrsi - coin->current->hdrsi) < coin->MAXBUNDLES && (bp == coin->current || netBLOCKS < 50*bp->n) )
{
@ -994,7 +995,7 @@ double iguana_bundlemissings(struct iguana_info *coin,double mult,struct iguana_
return(aveduration);
}
}
}
}*/
if ( (n= iguana_bundlerequests(coin,missings,&bp->origmissings,&tmp,mult,bp,priority)) > 0 )
{
bp->numissued += n;
@ -1045,7 +1046,7 @@ void iguana_bundlestats(struct iguana_info *coin,char *str,int32_t lag)
{
if ( bp->hdrsi >= starti && bp->hdrsi < lasti && (displag % 3) == 2 )
{
if ( (aveduration= iguana_bundlemissings(coin,mult,bp,recentduration)) != 0 )
if ( (aveduration= iguana_bundlemissings(coin,bp,recentduration)) != 0 )
dxblend(&recentduration,aveduration,.5);
}
if ( coin->enableCACHE != 0 )

31
iguana/iguana_init.c

@ -441,7 +441,7 @@ void iguana_coinpurge(struct iguana_info *coin)
struct iguana_info *iguana_coinstart(struct iguana_info *coin,int32_t initialheight,int32_t mapflags)
{
FILE *fp; char fname[512],*symbol; int32_t iter;
FILE *fp,*fp2; char fname[512],*symbol; int32_t iter;
coin->sleeptime = 10000;
symbol = coin->symbol;
if ( iguana_peerslotinit(coin,&coin->internaladdr,IGUANA_MAXPEERS,calc_ipbits("127.0.0.1:7777")) < 0 )
@ -471,10 +471,35 @@ struct iguana_info *iguana_coinstart(struct iguana_info *coin,int32_t initialhei
iguana_genesis(coin,coin->chain);
for (iter=coin->peers.numranked>8; iter<2; iter++)
{
sprintf(fname,"confs/%s_%s.txt",coin->symbol,(iter == 0) ? "peers" : "hdrs");
sprintf(fname,"tmp/%s/%s.txt",coin->symbol,(iter == 0) ? "peers" : "hdrs");
OS_compatible_path(fname);
printf("parsefile.%d %s\n",iter,fname);
if ( (fp= fopen(fname,"r")) != 0 )
if ( (fp= fopen(fname,"r")) == 0 )
{
sprintf(fname,"confs/%s_%s.txt",coin->symbol,(iter == 0) ? "peers" : "hdrs");
OS_compatible_path(fname);
fp = fopen(fname,"r");
}
else if ( iter == 1 )
{
sprintf(fname,"confs/%s_%s.txt",coin->symbol,(iter == 0) ? "peers" : "hdrs");
OS_compatible_path(fname);
if ( (fp2= fopen(fname,"r")) != 0 )
{
fseek(fp,0,SEEK_END), fseek(fp2,0,SEEK_END);
if ( ftell(fp2) > ftell(fp) )
{
fclose(fp);
fp = fp2;
}
else
{
fclose(fp2);
printf("%s is not used as tmp version is bigger\n",fname);
}
}
}
if ( fp != 0 )
{
iguana_parseline(coin,iter,fp);
fclose(fp);

Loading…
Cancel
Save