Browse Source

test

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

4
iguana/iguana777.h

@ -47,7 +47,7 @@ typedef int32_t (*blockhashfunc)(uint8_t *blockhashp,uint8_t *serialized,int32_t
#define IGUANA_TAILPERCENTAGE 1.0
#define IGUANA_MAXPENDHDRS 1
#define IGUANA_MAXPENDINGREQUESTS 3
#define IGUANA_PENDINGREQUESTS 64
#define IGUANA_PENDINGREQUESTS 32
#define IGUANA_MINPENDBUNDLES 4
#define IGUANA_MAXPENDBUNDLES 16
#define IGUANA_RPCPORT 7778
@ -882,7 +882,7 @@ int32_t iguana_voutsfname(struct iguana_info *coin,char *fname,int32_t slotid);
int32_t iguana_vinsfname(struct iguana_info *coin,char *fname,int32_t slotid);
bits256 iguana_merkle(struct iguana_info *coin,bits256 *tree,int32_t txn_count);
int32_t iguana_bundleready(struct iguana_info *coin,struct iguana_bundle *bp,int32_t requiredflag);
int32_t iguana_blast(struct iguana_info *coin,int32_t modval);
int32_t iguana_blast(struct iguana_info *coin,struct iguana_peer *addr);
extern int32_t HDRnet,netBLOCKS;

19
iguana/iguana_bundles.c

@ -623,18 +623,23 @@ int32_t iguana_bundleissuemissing(struct iguana_info *coin,struct iguana_bundle
return(n);
}
int32_t iguana_blast(struct iguana_info *coin,int32_t modval)
int32_t iguana_blast(struct iguana_info *coin,struct iguana_peer *addr)
{
struct iguana_bundle *bp; int32_t i,range,n = 0;
struct iguana_bundle *bp; bits256 hash2; int32_t i,range,n = 0;
if ( (bp= coin->current) != 0 && (range= (coin->bundlescount - bp->hdrsi)) > 0 )
{
modval %= range;
if ( (bp= coin->bundles[bp->hdrsi + modval]) != 0 )
if ( (bp= coin->bundles[bp->hdrsi + (addr->addrind % range)]) != 0 )
{
for (i=0; i<bp->n; i++)
for (i=0; i<bp->n && n<IGUANA_PENDINGREQUESTS; i++)
if ( GETBIT(bp->haveblock,i) == 0 )
bp->issued[i] = 0;
n = iguana_bundleissuemissing(coin,bp,3,1.);
{
iguana_bundleblock(coin,&hash2,bp,i);
if ( bits256_nonz(hash2) != 0 )
{
n++;
iguana_sendblockreqPT(coin,addr,bp,i,hash2,0);
}
}
printf("blasted.%d -> [%d]\n",n,bp->hdrsi);
}
}

4
iguana/iguana_recv.c

@ -337,8 +337,8 @@ void iguana_gotblockM(struct iguana_info *coin,struct iguana_peer *addr,struct i
coin->bandwidth = bw;
if ( coin->bandwidth < 0.25*coin->maxbandwidth )
{
printf(">>SLOW<< ");
iguana_blast(coin,addr->addrind);
printf(">>SLOW.%d<< ",addr->addrind);
iguana_blast(coin,addr);
}
char str[65],str2[65],str3[65],str4[65]; printf("%s BLOCKS.%llu RECV %s ave %.1f | dup.%d %s after.%d %s %s/sec %.2f%%\n",coin->symbol,(long long)sum2,mbstr(str,sum),(double)sum/(sum2!=0?sum2:1),numDuplicates,mbstr(str2,sizeDuplicates),numAfteremit,mbstr(str3,sizeAfteremit),mbstr(str4,bw),coin->maxbandwidth!=0.?100.*coin->bandwidth/coin->maxbandwidth:0.);
last = now;

Loading…
Cancel
Save