From 3d01e764aad396e3648f394c5d7c63255541c57f Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 3 Dec 2017 21:22:59 +0400 Subject: [PATCH] Test --- iguana/exchanges/LP_instantdex.c | 12 +++++++++++- iguana/exchanges/LP_stats.c | 12 ++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/iguana/exchanges/LP_instantdex.c b/iguana/exchanges/LP_instantdex.c index 176c4abd0..9cbcdca45 100644 --- a/iguana/exchanges/LP_instantdex.c +++ b/iguana/exchanges/LP_instantdex.c @@ -447,7 +447,7 @@ int64_t LP_myzcredits() cJSON *LP_swapstats_item(struct LP_swapstats *sp,int32_t iambob) { - struct iguana_info *bob,*alice; int32_t flag = 0; bits256 zero; cJSON *item,*reqjson; + struct iguana_info *bob,*alice; int32_t flag = 0; char *retstr,*swapstr; bits256 zero; cJSON *item,*reqjson,*swapjson; item = cJSON_CreateObject(); jaddnum(item,"iambob",iambob); jaddnum(item,"aliceid",sp->aliceid); @@ -482,6 +482,16 @@ cJSON *LP_swapstats_item(struct LP_swapstats *sp,int32_t iambob) jadd64bits(reqjson,"aliceid",sp->aliceid); memset(zero.bytes,0,sizeof(zero)); LP_reserved_msg(0,"","",zero,jprint(reqjson,1)); + if ( (swapstr= basilisk_swapentry(sp->Q.R.requestid,sp->Q.R.quoteid,1)) != 0 ) + { + if ( (swapjson= cJSON_Parse(swapstr)) != 0 ) + { + if ( (retstr= LP_swapstatus_recv(swapjson)) != 0 ) + free(retstr); + free_json(swapjson); + } + free(swapstr); + } } } return(item); diff --git a/iguana/exchanges/LP_stats.c b/iguana/exchanges/LP_stats.c index c63b08957..cd250dcfe 100644 --- a/iguana/exchanges/LP_stats.c +++ b/iguana/exchanges/LP_stats.c @@ -518,7 +518,7 @@ cJSON *LP_swapstats_json(struct LP_swapstats *sp) char *LP_swapstatus_recv(cJSON *argjson) { - struct LP_swapstats *sp; char *statusstr; uint64_t aliceid; double qprice; struct LP_quoteinfo Q; int32_t methodind,RTflag; bits256 txid; //char str[65]; + struct LP_swapstats *sp; char *statusstr; uint64_t aliceid; double qprice; struct LP_quoteinfo Q; int32_t methodind,RTflag; bits256 txid; char str[65]; if ( (aliceid= j64bits(argjson,"aliceid")) == 0 ) return(clonestr("{\"error\":\"LP_swapstatus_recv null aliceid\"}")); if ( (sp= LP_swapstats_find(aliceid)) == 0 ) @@ -549,31 +549,31 @@ char *LP_swapstatus_recv(cJSON *argjson) if ( bits256_nonz(txid) != 0 && bits256_nonz(sp->bobdeposit) == 0 ) { sp->bobdeposit = txid; - //printf("set aliceid.%llu bobdeposit %s\n",(long long)sp->aliceid,bits256_str(str,txid)); + printf("set aliceid.%llu bobdeposit %s\n",(long long)sp->aliceid,bits256_str(str,txid)); } txid = jbits256(argjson,"alicepayment"); if ( bits256_nonz(txid) != 0 && bits256_nonz(sp->alicepayment) == 0 ) { sp->alicepayment = txid; - //printf("set aliceid.%llu alicepayment %s\n",(long long)sp->aliceid,bits256_str(str,txid)); + printf("set aliceid.%llu alicepayment %s\n",(long long)sp->aliceid,bits256_str(str,txid)); } txid = jbits256(argjson,"bobpayment"); if ( bits256_nonz(txid) != 0 && bits256_nonz(sp->bobpayment) == 0 ) { sp->bobpayment = txid; - //printf("set aliceid.%llu bobpayment %s\n",(long long)sp->aliceid,bits256_str(str,txid)); + printf("set aliceid.%llu bobpayment %s\n",(long long)sp->aliceid,bits256_str(str,txid)); } txid = jbits256(argjson,"paymentspent"); if ( bits256_nonz(txid) != 0 && bits256_nonz(sp->paymentspent) == 0 ) { sp->paymentspent = txid; - //printf("set aliceid.%llu paymentspent %s\n",(long long)sp->aliceid,bits256_str(str,txid)); + printf("set aliceid.%llu paymentspent %s\n",(long long)sp->aliceid,bits256_str(str,txid)); } txid = jbits256(argjson,"Apaymentspent"); if ( bits256_nonz(txid) != 0 && bits256_nonz(sp->Apaymentspent) == 0 ) { sp->Apaymentspent = txid; - //printf("set aliceid.%llu Apaymentspent %s\n",(long long)sp->aliceid,bits256_str(str,txid)); + printf("set aliceid.%llu Apaymentspent %s\n",(long long)sp->aliceid,bits256_str(str,txid)); } txid = jbits256(argjson,"depositspent"); if ( bits256_nonz(txid) != 0 && bits256_nonz(sp->depositspent) == 0 )