Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
e7c7c54b10
  1. 14
      deprecated/obsolete.h
  2. 22
      iguana/iguana777.c
  3. 13
      iguana/iguana_bundles.c
  4. 2
      iguana/iguana_recv.c

14
deprecated/obsolete.h

@ -11206,5 +11206,17 @@ void iguana_dedicatedrecv(void *arg)
}
}
}
if ( 0 && coin->newramchain != 0 && now > coin->savedblocks+60 )
{
char fname[512]; FILE *fp;
sprintf(fname,"blocks.%s",coin->symbol), OS_compatible_path(fname);
if ( (fp= fopen(fname,"wb")) != 0 )
{
if ( fwrite(coin->blocks.RO,sizeof(*coin->blocks.RO),coin->longestchain,fp) != coin->longestchain )
printf("error saving blocks\n");
else printf("%s saved\n",fname);
fclose(fp);
coin->savedblocks = (uint32_t)time(NULL);
}
}
#endif

22
iguana/iguana777.c

@ -356,25 +356,13 @@ void iguana_coinloop(void *arg)
bp->bundleheight = 0;
while ( 1 )
{
//printf("iter\n");
flag = 0;
for (i=0; i<n; i++)
{
if ( (coin= coins[i]) != 0 )
{
now = (uint32_t)time(NULL);
if ( 0 && coin->newramchain != 0 && now > coin->savedblocks+60 )
{
char fname[512]; FILE *fp;
sprintf(fname,"blocks.%s",coin->symbol), OS_compatible_path(fname);
if ( (fp= fopen(fname,"wb")) != 0 )
{
if ( fwrite(coin->blocks.RO,sizeof(*coin->blocks.RO),coin->longestchain,fp) != coin->longestchain )
printf("error saving blocks\n");
else printf("%s saved\n",fname);
fclose(fp);
coin->savedblocks = (uint32_t)time(NULL);
}
}
if ( coin->isRT == 0 && now > coin->startutc+600 && coin->blocksrecv >= coin->longestchain-1 && coin->blocks.hwmchain.height >= coin->longestchain-1 )
{
printf(">>>>>>> %s isRT blockrecv.%d vs longest.%d\n",coin->symbol,coin->blocksrecv,coin->longestchain);
@ -384,14 +372,19 @@ void iguana_coinloop(void *arg)
coin->MAXPEERS = 8;
}
if ( coin->peers.numranked != 0 && coin->peers.numranked < (coin->MAXPEERS>>1) && now > coin->lastpossible )
{
//printf("possible\n");
coin->lastpossible = iguana_possible_peer(coin,0); // tries to connect to new peers
}
if ( coin->active != 0 )
{
if ( now > coin->peers.lastmetrics+6 )
{
//printf("metrics\n");
coin->peers.lastmetrics = iguana_updatemetrics(coin); // ranks peers
coin->lastpossible = iguana_possible_peer(coin,0); // tries to connect to new peers
}
//printf("process\n");
flag += iguana_processrecv(coin);
if ( 0 && coin->blocks.parsedblocks < coin->blocks.hwmchain.height-coin->chain->minconfirms )
{
@ -399,13 +392,14 @@ void iguana_coinloop(void *arg)
iguana_syncs(coin), flag++; // merge ramchain fragments into full ramchain
}
lastdisp = (uint32_t)now;
//printf("now.%u\n",now);
iguana_bundlestats(coin,str);
if ( str[0] != 0 )
{
if ( (rand() % 1000) == 0 )
myallocated(0,0);
}
iguana_ramchainmerge(coin);
//iguana_ramchainmerge(coin);
}
}// bp block needs mutex
}

13
iguana/iguana_bundles.c

@ -429,8 +429,8 @@ int64_t iguana_bundlecalcs(struct iguana_info *coin,struct iguana_bundle *bp)
bp->numhashes++;
}
}
bp->metric = 0.;
if ( bp->numsaved > 0 )
bp->metric = bp->numhashes;
//if ( bp->numsaved > 0 )
{
bp->estsize = ((uint64_t)bp->datasize * bp->n) / (bp->numrecv+1);
if ( bp->numsaved >= bp->n && bp->emitfinish == 0 )
@ -441,6 +441,7 @@ int64_t iguana_bundlecalcs(struct iguana_info *coin,struct iguana_bundle *bp)
}
else bp->metric = sqrt((sqrt(fabs(bp->estsize - bp->datasize)) * (bp->n - bp->numsaved)) * (bp->hdrsi + 1));
}
//printf("%f ",bp->metric);
return(bp->estsize);
}
@ -491,8 +492,8 @@ void iguana_bundlestats(struct iguana_info *coin,char *str)
}
if ( n > 0 )
{
struct iguana_peer *addr; uint32_t now; struct iguana_block *block; int32_t flag,origissue,j,issue,pend = 0;
flag = 0;
struct iguana_peer *addr; uint32_t now; struct iguana_block *block; int32_t m,flag,origissue,j,issue,pend = 0;
flag = m = 0;
sortds(&coin->rankedbps[0][0],n,sizeof(coin->rankedbps[0]));
for (i=0; i<coin->peers.numranked; i++)
{
@ -503,7 +504,7 @@ void iguana_bundlestats(struct iguana_info *coin,char *str)
if ( origissue < 8 )
origissue = 8;
issue = origissue;
while ( issue > 0 )
while ( issue > 0 && m++ < 100 )
{
now = (uint32_t)time(NULL);
for (i=0; i<n; i++)
@ -533,7 +534,7 @@ void iguana_bundlestats(struct iguana_info *coin,char *str)
}
/*for (i=0; i<n&&i<3; i++)
printf("(%.5f %.0f).%d ",coin->rankedbps[i][0],coin->rankedbps[i][1],coin->bundles[(int32_t)coin->rankedbps[i][1]]->numrecv);*/
if ( flag != 0 )
//if ( flag != 0 )
printf("rem.%d issue.%d pend.%d | numranked.%d\n",n,origissue,pend,coin->peers.numranked);
}
coin->numremain = n;

2
iguana/iguana_recv.c

@ -390,7 +390,7 @@ struct iguana_bundlereq *iguana_recvblockhdrs(struct iguana_info *coin,struct ig
printf("iguana_recvblockhdrs null blocks?\n");
return(req);
}
printf("GOT HDRS[%d]\n",n);
printf("GOT HDRS[%d] Q.%d %d\n",n,queue_size(&coin->priorityQ),queue_size(&coin->blocksQ));
if ( blocks != 0 && n > 0 )
{
for (i=0; i<n; i++)

Loading…
Cancel
Save