Browse Source

test

release/v0.1
jl777 8 years ago
parent
commit
7b6f623262
  1. 2
      basilisk/basilisk.c
  2. 10
      basilisk/basilisk_ping.c

2
basilisk/basilisk.c

@ -887,7 +887,7 @@ HASH_ARRAY_STRING(basilisk,balances,hash,vals,hexstr)
coin = iguana_coinfind(symbol);
}
if ( jobj(vals,"fanout") == 0 )
jaddnum(vals,"fanout",(int32_t)sqrt(myinfo->numrelays));
jaddnum(vals,"fanout",(int32_t)sqrt(myinfo->numrelays)+1);
if ( jobj(vals,"numrequired") == 0 )
jaddnum(vals,"numrequired",myinfo->numrelays);
if ( coin != 0 )

10
basilisk/basilisk_ping.c

@ -269,19 +269,25 @@ int32_t basilisk_ping_gen(struct supernet_info *myinfo,uint8_t *data,int32_t max
void basilisk_ping_send(struct supernet_info *myinfo,struct iguana_info *btcd)
{
struct iguana_peer *addr; char ipaddr[64]; struct basilisk_relay *rp; uint32_t r; int32_t i,j,incr,datalen=0;
struct iguana_peer *addr; char ipaddr[64]; struct basilisk_relay *rp; uint32_t r; int32_t i,j,incr,datalen=0; uint64_t alreadysent;
if ( btcd == 0 || myinfo->numrelays <= 0 )
return;
if ( myinfo->pingbuf == 0 )
myinfo->pingbuf = malloc(IGUANA_MAXPACKETSIZE);
datalen = basilisk_ping_gen(myinfo,&myinfo->pingbuf[sizeof(struct iguana_msghdr)],IGUANA_MAXPACKETSIZE-sizeof(struct iguana_msghdr));
incr = sqrt(myinfo->numrelays) + 1;
for (j=0; j<=incr; j++)
for (alreadysent=j=0; j<=incr; j++)
{
OS_randombytes((void *)&r,sizeof(r));
i = (j == 0) ? myinfo->RELAYID : (r % myinfo->numrelays);
if ( j != 0 && i == myinfo->RELAYID )
i = (myinfo->RELAYID + 1) % myinfo->numrelays;
if ( (((uint64_t)1 << i) & alreadysent) != 0 )
{
j--;
continue;
}
alreadysent |= ((uint64_t)1 << i);
rp = &myinfo->relays[i];
addr = 0;
expand_ipbits(ipaddr,rp->ipbits);

Loading…
Cancel
Save