Browse Source

Test

etomic
jl777 8 years ago
parent
commit
f83744e517
  1. 2
      iguana/exchanges/LP_commands.c
  2. 2
      iguana/exchanges/LP_forwarding.c
  3. 11
      iguana/exchanges/LP_quotes.c

2
iguana/exchanges/LP_commands.c

@ -46,7 +46,7 @@ char *stats_JSON(int32_t pubsock,cJSON *argjson,char *remoteaddr,uint16_t port)
} }
if ( (method= jstr(argjson,"method")) == 0 ) if ( (method= jstr(argjson,"method")) == 0 )
{ {
if ( flag == 0 && jobj(argjson,"result") == 0 ) if ( flag == 0 || jobj(argjson,"result") == 0 )
printf("stats_JSON no method: (%s)\n",jprint(argjson,0)); printf("stats_JSON no method: (%s)\n",jprint(argjson,0));
return(clonestr("{\"error\":\"need method in request\"}")); return(clonestr("{\"error\":\"need method in request\"}"));
} }

2
iguana/exchanges/LP_forwarding.c

@ -133,11 +133,11 @@ char *LP_forwardhex(int32_t pubsock,bits256 pubkey,char *hexstr)
datalen = (int32_t)strlen(hexstr) >> 1; datalen = (int32_t)strlen(hexstr) >> 1;
data = malloc(datalen); data = malloc(datalen);
decode_hex(data,datalen,hexstr); decode_hex(data,datalen,hexstr);
printf("LP_forwardhex.(%s)\n",(char *)data);
if ( (argjson= cJSON_Parse((char *)data)) != 0 ) if ( (argjson= cJSON_Parse((char *)data)) != 0 )
{ {
reqjson = LP_dereference(argjson,"forward"); reqjson = LP_dereference(argjson,"forward");
retstr = LP_command_process(LP_mypeer != 0 ? LP_mypeer->ipaddr : "127.0.0.1",LP_mypubsock,reqjson,0,0,LP_profitratio - 1.); retstr = LP_command_process(LP_mypeer != 0 ? LP_mypeer->ipaddr : "127.0.0.1",LP_mypubsock,reqjson,0,0,LP_profitratio - 1.);
printf("LP_forwardhex.(%s) -> (%s)\n",jprint(reqjson,0),retstr!=0?retstr:"");
if ( pubsock >= 0 ) if ( pubsock >= 0 )
LP_send(pubsock,jprint(reqjson,0),1); LP_send(pubsock,jprint(reqjson,0),1);
free_json(reqjson); free_json(reqjson);

11
iguana/exchanges/LP_quotes.c

@ -246,9 +246,18 @@ double LP_query(char *method,struct LP_quoteinfo *qp)
reqjson = LP_quotejson(qp); reqjson = LP_quotejson(qp);
if ( bits256_nonz(qp->desthash) != 0 ) if ( bits256_nonz(qp->desthash) != 0 )
flag = 1; flag = 1;
jaddstr(reqjson,"method",method);
printf("QUERY.(%s)\n",jprint(reqjson,0)); printf("QUERY.(%s)\n",jprint(reqjson,0));
if ( IAMLP != 0 )
{
jaddstr(reqjson,"method",method);
LP_send(LP_mypubsock,jprint(reqjson,1),1);
}
else
{
jaddstr(reqjson,"method2",method);
jaddstr(reqjson,"method","forward");
LP_forward(qp->srchash,jprint(reqjson,1),1); LP_forward(qp->srchash,jprint(reqjson,1),1);
}
for (i=0; i<30; i++) for (i=0; i<30; i++)
{ {
if ( (price= LP_pricecache(qp,qp->srccoin,qp->destcoin,qp->txid,qp->vout)) > SMALLVAL ) if ( (price= LP_pricecache(qp,qp->srccoin,qp->destcoin,qp->txid,qp->vout)) > SMALLVAL )

Loading…
Cancel
Save