From d2a991f5ec624de1acaab275c32f74785ad54954 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 31 May 2017 19:01:35 +0300 Subject: [PATCH] Test --- iguana/exchanges/LP_commands.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 3a03be77d..7d34bfe5d 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -318,7 +318,22 @@ void LP_command(struct LP_peerinfo *mypeer,int32_t pubsock,cJSON *argjson,uint8_ if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)LP_bobloop,(void *)utxo) == 0 ) { retjson = cJSON_CreateObject(); - jaddstr(retjson,"result","connected"); + jaddstr(retjson,"base",base); + jaddstr(retjson,"rel",rel); + jaddstr(retjson,"address",utxo->coinaddr); + jaddnum(retjson,"timestamp",timestamp); + jaddnum(retjson,"quotetime",quotetime); + jaddnum(retjson,"price",price); + jaddbits256(retjson,"txid",txid); + jaddnum(retjson,"vout",utxo->vout); + pubkey = LP_pubkey(LP_privkey(utxo->coinaddr)); + jaddbits256(retjson,"srchash",pubkey); + jadd64bits(retjson,"txfee",txfee); + jadd64bits(retjson,"desttxfee",desttxfee); + jadd64bits(retjson,"value",utxo->satoshis); + jadd64bits(retjson,"satoshis",utxo->satoshis - txfee); + jadd64bits(retjson,"destsatoshis",price * (utxo->satoshis-txfee) + desttxfee); + jaddstr(retjson,"method","connected"); jaddstr(retjson,"pair",pairstr); jaddnum(retjson,"requestid",R.requestid); jaddnum(retjson,"quoteid",R.quoteid); @@ -380,6 +395,8 @@ char *stats_JSON(cJSON *argjson,char *remoteaddr,uint16_t port) // from rpc port } if ( strcmp(method,"quote") == 0 || strcmp(method,"reserved") == 0 ) retstr = LP_quote(juint(argjson,"pending"),jstr(argjson,"base"),jstr(argjson,"rel"),jbits256(argjson,"txid"),jint(argjson,"vout"),jdouble(argjson,"price"),j64bits(argjson,"satoshis"),j64bits(argjson,"txfee"),j64bits(argjson,"destsatoshis"),j64bits(argjson,"desttxfee"),jbits256(argjson,"otherpubkey")); + else if ( IAMCLIENT != 0 && strcmp(method,"connected") == 0 ) + retstr = jprint(argjson,0); else if ( IAMCLIENT == 0 && strcmp(method,"getprice") == 0 ) retstr = LP_pricestr(jstr(argjson,"base"),jstr(argjson,"rel")); else if ( IAMCLIENT == 0 && strcmp(method,"getpeers") == 0 )