Browse Source

test

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

2
iguana/iguana_bundles.c

@ -421,7 +421,7 @@ int64_t iguana_bundlecalcs(struct iguana_info *coin,struct iguana_bundle *bp,int
} }
} }
//bp->metric = bp->numhashes; //bp->metric = bp->numhashes;
bp->metric = 1000 + sqrt(sqrt(bp->n * (1 + bp->numsaved + bp->numrecv)) * (10 + coin->bundlescount - bp->hdrsi)); bp->metric = coin->bundlescount - bp->hdrsi;//1000 + sqrt(sqrt(bp->n * (1 + bp->numsaved + bp->numrecv)) * (10 + coin->bundlescount - bp->hdrsi));
if ( done > coin->bundlescount*IGUANA_HEADPERCENTAGE && bp->hdrsi > coin->bundlescount*IGUANA_TAILPERCENTAGE ) if ( done > coin->bundlescount*IGUANA_HEADPERCENTAGE && bp->hdrsi > coin->bundlescount*IGUANA_TAILPERCENTAGE )
bp->metric *= 1000; bp->metric *= 1000;
return(bp->estsize); return(bp->estsize);

13
iguana/iguana_recv.c

@ -394,7 +394,7 @@ void iguana_bundlespeculate(struct iguana_info *coin,struct iguana_bundle *bp,in
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,n,better,issued,valid,pend,max,counter = 0; uint32_t now; struct iguana_block *block; double endmillis,width; int32_t i,n,range,better,issued,valid,pend,max,counter = 0; uint32_t now; struct iguana_block *block; double endmillis,width;
coin->numbundlesQ--; coin->numbundlesQ--;
//printf("BUNDLEITERS.%d\n",bp->hdrsi); //printf("BUNDLEITERS.%d\n",bp->hdrsi);
if ( bp->numhashes < bp->n && bp->bundleheight < coin->longestchain-coin->chain->bundlesize ) if ( bp->numhashes < bp->n && bp->bundleheight < coin->longestchain-coin->chain->bundlesize )
@ -418,7 +418,11 @@ int32_t iguana_bundleiters(struct iguana_info *coin,struct iguana_bundle *bp,int
iguana_bundleQ(coin,bp,bp->n*5); iguana_bundleQ(coin,bp,bp->n*5);
return(0); return(0);
} }
if ( 1 && coin->current != 0 && bp->rank != 0 && bp->rank <= coin->current->hdrsi + coin->peers.numranked ) if ( (range= coin->peers.numranked) > IGUANA_MAXBUNDLES )
range = IGUANA_MAXBUNDLES;
if ( 1 && coin->current != 0 )
{
if ( bp->rank != 0 && bp->rank <= coin->current->hdrsi + range )
{ {
for (i=0; i<bp->n; i++) for (i=0; i<bp->n; i++)
{ {
@ -429,6 +433,7 @@ int32_t iguana_bundleiters(struct iguana_info *coin,struct iguana_bundle *bp,int
//printf("%d ",i); //printf("%d ",i);
} }
} }
}
//printf("initial requests for hdrs.%d\n",bp->hdrsi); //printf("initial requests for hdrs.%d\n",bp->hdrsi);
} }
pend = queue_size(&coin->priorityQ) + queue_size(&coin->blocksQ); pend = queue_size(&coin->priorityQ) + queue_size(&coin->blocksQ);
@ -1039,9 +1044,9 @@ int32_t iguana_pollQsPT(struct iguana_info *coin,struct iguana_peer *addr)
} }
if ( req == 0 ) if ( req == 0 )
{ {
if ( (rand() % 1) == 0 ) if ( (rand() % 10) == 0 )
flag = iguana_neargap(coin,addr); flag = iguana_neargap(coin,addr);
else if ( 1 && (bp= addr->bp) != 0 && bp->rank != 0 && addr->pendblocks < limit ) else if ( 0 && (bp= addr->bp) != 0 && bp->rank != 0 && addr->pendblocks < limit )
{ {
r = rand(); r = rand();
for (j=0; j<bp->n; j++) for (j=0; j<bp->n; j++)

Loading…
Cancel
Save