Browse Source

Test

etomic
jl777 8 years ago
parent
commit
fe6eca375d
  1. 2
      iguana/exchanges/LP_commands.c
  2. 6
      iguana/exchanges/LP_forwarding.c
  3. 4
      iguana/exchanges/LP_nativeDEX.c
  4. 2
      iguana/exchanges/LP_quotes.c

2
iguana/exchanges/LP_commands.c

@ -188,7 +188,7 @@ forwardhex(pubkey,hex)\n\
cJSON *reqjson;
if ( (reqjson= LP_dereference(argjson,"forward")) != 0 )
{
printf("FORWARDED.(%s)\n",jprint(argjson,0));
//printf("FORWARDED.(%s)\n",jprint(argjson,0));
if ( LP_forward(myipaddr,pubsock,profitmargin,jbits256(argjson,"pubkey"),jprint(reqjson,1),1) > 0 )
retstr = clonestr("{\"result\":\"success\"}");
else retstr = clonestr("{\"error\":\"error forwarding\"}");

6
iguana/exchanges/LP_forwarding.c

@ -138,7 +138,7 @@ char *LP_forwardhex(int32_t pubsock,bits256 pubkey,char *hexstr)
if ( reqjson != 0 )
{
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:"");
//printf("LP_forwardhex.(%s) -> (%s)\n",jprint(reqjson,0),retstr!=0?retstr:"");
if ( pubsock >= 0 )
LP_send(pubsock,jprint(reqjson,0),0);
} else printf("LP_forwardhex couldnt parse (%s)\n",(char *)data);
@ -147,7 +147,7 @@ char *LP_forwardhex(int32_t pubsock,bits256 pubkey,char *hexstr)
{
if ( ptr->pushsock >= 0 )
{
printf("%s forwardhex.(%s)\n",ptr->pushaddr,(char *)data);
//printf("%s forwardhex.(%s)\n",ptr->pushaddr,(char *)data);
sentbytes = LP_send(ptr->pushsock,(char *)data,0);
}
retjson = cJSON_CreateObject();
@ -189,7 +189,7 @@ int32_t LP_forward(char *myipaddr,int32_t pubsock,double profitmargin,bits256 pu
{
if ( bits256_cmp(pubkey,LP_mypubkey) == 0 )
{
printf("GOT FORWARDED.(%s)\n",jsonstr);
//printf("GOT FORWARDED.(%s)\n",jsonstr);
if ( (argjson= cJSON_Parse(jsonstr)) != 0 )
{
if ( (retstr= LP_command_process(myipaddr,pubsock,argjson,0,0,profitmargin)) != 0 )

4
iguana/exchanges/LP_nativeDEX.c

@ -86,7 +86,7 @@ char *LP_command_process(char *myipaddr,int32_t pubsock,cJSON *argjson,uint8_t *
{
if ( (retstr= stats_JSON(myipaddr,pubsock,profitmargin,argjson,"127.0.0.1",0)) != 0 )
{
printf("%s PULL.[%d]-> (%s)\n",myipaddr != 0 ? myipaddr : "127.0.0.1",datalen,retstr);
//printf("%s PULL.[%d]-> (%s)\n",myipaddr != 0 ? myipaddr : "127.0.0.1",datalen,retstr);
if ( pubsock >= 0 )
LP_send(pubsock,retstr,0);
}
@ -114,7 +114,7 @@ int32_t LP_pullsock_check(char *myipaddr,int32_t pubsock,int32_t pullsock,double
portable_mutex_lock(&LP_commandmutex);
if ( jstr(argjson,"method") != 0 && strcmp(jstr(argjson,"method"),"forwardhex") == 0 )
{
printf("got forwardhex\n");
//printf("got forwardhex\n");
if ( (retstr= LP_forwardhex(pubsock,jbits256(argjson,"pubkey"),jstr(argjson,"hex"))) != 0 )
free(retstr);
}

2
iguana/exchanges/LP_quotes.c

@ -387,7 +387,7 @@ int32_t LP_tradecommand(char *myipaddr,int32_t pubsock,cJSON *argjson,uint8_t *d
char *method,*base,*rel,*retstr; cJSON *retjson; double price,bid,ask; bits256 txid,spendtxid; struct LP_utxoinfo *utxo; int32_t selector,spendvini,retval = -1; struct LP_quoteinfo Q;
if ( (method= jstr(argjson,"method")) != 0 && (strcmp(method,"request") == 0 ||strcmp(method,"connect") == 0) )
{
printf("TRADECOMMAND.(%s)\n",jprint(argjson,0));
//printf("TRADECOMMAND.(%s)\n",jprint(argjson,0));
retval = 1;
txid = jbits256(argjson,"txid");
if ( (utxo= LP_utxofind(1,txid,jint(argjson,"vout"))) != 0 && LP_ismine(utxo) > 0 && (base= jstr(argjson,"base")) != 0 && (rel= jstr(argjson,"rel")) != 0 && strcmp(base,utxo->coin) == 0 )

Loading…
Cancel
Save