Browse Source

Test

etomic
jl777 7 years ago
parent
commit
dfbbc1d48f
  1. 10
      iguana/exchanges/LP_peers.c
  2. 7
      iguana/exchanges/LP_signatures.c

10
iguana/exchanges/LP_peers.c

@ -210,6 +210,7 @@ int32_t LP_numpeers()
struct LP_peerinfo *peer,*tmp; int32_t numpeers = 0;
HASH_ITER(hh,LP_peerinfos,peer,tmp)
{
if ( peer->isLP != 0 )
numpeers++;
}
return(numpeers);
@ -218,15 +219,15 @@ int32_t LP_numpeers()
uint16_t LP_randpeer(char *destip)
{
struct LP_peerinfo *peer,*tmp; uint16_t port = 0; int32_t n,r,numpeers = 0;
HASH_ITER(hh,LP_peerinfos,peer,tmp)
{
numpeers++;
}
destip[0] = 0;
numpeers = LP_numpeers();
if ( numpeers > 0 )
{
r = rand() % numpeers;
n = 0;
HASH_ITER(hh,LP_peerinfos,peer,tmp)
{
if ( peer->isLP != 0 )
{
if ( n++ == r )
{
@ -236,5 +237,6 @@ uint16_t LP_randpeer(char *destip)
}
}
}
}
return(port);
}

7
iguana/exchanges/LP_signatures.c

@ -559,7 +559,7 @@ int32_t LP_pubkey_sigcheck(struct LP_pubkeyinfo *pubp,cJSON *item)
void LP_notify_pubkeys(void *ctx,int32_t pubsock)
{
bits256 zero; uint32_t timestamp; char secpstr[67]; cJSON *reqjson = cJSON_CreateObject();
bits256 zero; uint32_t timestamp; char LPipaddr[64],secpstr[67]; cJSON *reqjson = cJSON_CreateObject();
memset(zero.bytes,0,sizeof(zero));
jaddstr(reqjson,"method","notify");
jaddstr(reqjson,"rmd160",G.LP_myrmd160str);
@ -570,7 +570,10 @@ void LP_notify_pubkeys(void *ctx,int32_t pubsock)
jaddnum(reqjson,"timestamp",timestamp);
LP_pubkey_sigadd(reqjson,timestamp,G.LP_privkey,G.LP_mypub25519,G.LP_myrmd160,G.LP_pubsecp);
if ( IAMLP != 0 )
jaddstr(reqjson,"isLP",LP_myipaddr);
{
if ( LP_randpeer(LPipaddr) != 0 )
jaddstr(reqjson,"isLP",LPipaddr);
}
jaddnum(reqjson,"session",G.LP_sessionid);
LP_reserved_msg(0,"","",zero,jprint(reqjson,1));
}

Loading…
Cancel
Save