Browse Source

Test

etomic
jl777 8 years ago
parent
commit
952c33b591
  1. 20
      iguana/exchanges/LP_forwarding.c

20
iguana/exchanges/LP_forwarding.c

@ -335,26 +335,18 @@ int32_t LP_forward(void *ctx,char *myipaddr,int32_t pubsock,double profitmargin,
reqjson = cJSON_CreateObject(); reqjson = cJSON_CreateObject();
jaddstr(reqjson,"method","forwardhex"); jaddstr(reqjson,"method","forwardhex");
jaddstr(reqjson,"hex",hexstr); jaddstr(reqjson,"hex",hexstr);
jaddbits256(reqjson,"pubkey",pubkey);
free(hexstr); free(hexstr);
msg = jprint(reqjson,1); msg = jprint(reqjson,1);
mlen = (int32_t)strlen(msg) + 1; mlen = (int32_t)strlen(msg) + 1;
HASH_ITER(hh,LP_peerinfos,peer,tmp) HASH_ITER(hh,LP_peerinfos,peer,tmp)
{ {
if ( (retstr= issue_LP_lookup(peer->ipaddr,peer->port,pubkey)) != 0 ) if ( (retjson= cJSON_Parse(retstr)) != 0 )
{ {
if ( (retjson= cJSON_Parse(retstr)) != 0 ) //printf("found LPnode.(%s) forward.(%s)\n",peer->ipaddr,msg);
{ if ( LP_send(peer->pushsock,msg,mlen,0) == mlen )
if ( jint(retjson,"forwarding") != 0 && peer->pushsock >= 0 ) n++;
{ free_json(retjson);
printf("found LPnode.(%s) forward.(%s)\n",peer->ipaddr,msg); }
if ( LP_send(peer->pushsock,msg,mlen,0) == mlen )
n++;
} else printf("%s:%u doesnt forward pubkey (%s)\n",peer->ipaddr,peer->port,retstr);
free_json(retjson);
}
free(retstr);
} else printf("%s:%u doesnt have pubkey\n",peer->ipaddr,peer->port);
if ( n >= 8 )//sizeof(default_LPnodes)/sizeof(*default_LPnodes) ) if ( n >= 8 )//sizeof(default_LPnodes)/sizeof(*default_LPnodes) )
break; break;
} }

Loading…
Cancel
Save