From 2b53373bdc001d0933271ec7fc21fdaf74f3ad23 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 27 Oct 2017 15:14:34 +0300 Subject: [PATCH] Test --- iguana/exchanges/LP_commands.c | 7 ++++--- iguana/exchanges/LP_stats.c | 11 ++++++++++- iguana/exchanges/guistats | 3 +++ iguana/exchanges/pubkeydisp | 3 +++ 4 files changed, 20 insertions(+), 4 deletions(-) create mode 100755 iguana/exchanges/guistats create mode 100755 iguana/exchanges/pubkeydisp diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 68174dce2..1c207cb18 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -222,13 +222,14 @@ stop()\n\ } else if ( strcmp(method,"parselog") == 0 ) { - int32_t n = LP_statslog_parse(); - return(LP_statslog_disp(n,2000000000,2000000000)); + bits256 zero; int32_t n = LP_statslog_parse(); + memset(zero.bytes,0,sizeof(zero)); + return(LP_statslog_disp(n,2000000000,2000000000,"",zero)); } else if ( strcmp(method,"statsdisp") == 0 ) { int32_t n = LP_statslog_parse(); - return(LP_statslog_disp(n,juint(argjson,"starttime"),juint(argjson,"endtime"))); + return(LP_statslog_disp(n,juint(argjson,"starttime"),juint(argjson,"endtime"),jstr(argjson,"gui"),jbits256(argjson,"pubkey"))); } else if ( strcmp(method,"secretaddresses") == 0 ) { diff --git a/iguana/exchanges/LP_stats.c b/iguana/exchanges/LP_stats.c index 89919ef3f..e31cdd6db 100644 --- a/iguana/exchanges/LP_stats.c +++ b/iguana/exchanges/LP_stats.c @@ -321,7 +321,7 @@ int32_t LP_statslog_parsequote(char *method,cJSON *lineobj) return(duplicate == 0); } -char *LP_statslog_disp(int32_t n,uint32_t starttime,uint32_t endtime) +char *LP_statslog_disp(int32_t n,uint32_t starttime,uint32_t endtime,char *refgui,bits256 refpubkey) { cJSON *retjson,*array,*item; struct LP_swapstats *sp,*tmp; int32_t i,dispflag,numtrades[LP_MAXPRICEINFOS]; char line[1024]; uint64_t basevols[LP_MAXPRICEINFOS],relvols[LP_MAXPRICEINFOS]; if ( starttime > endtime ) @@ -345,6 +345,15 @@ char *LP_statslog_disp(int32_t n,uint32_t starttime,uint32_t endtime) else if ( sp->Q.timestamp >= starttime && sp->Q.timestamp <= endtime ) dispflag = 1; if ( dispflag != 0 ) + { + dispflag = 0; + if ( refgui == 0 || refgui[0] == 0 || strcmp(refgui,sp->bobgui) == 0 || strcmp(refgui,sp->alicegui) == 0 ) + { + if ( bits256_nonz(refpubkey) == 0 || bits256_cmp(refpubkey,sp->Q.srchash) == 0 || bits256_cmp(refpubkey,sp->Q.desthash) == 0 ) + dispflag = 1; + } + } + if ( dispflag != 0 ) { LP_swapstats_line(numtrades,basevols,relvols,line,sp); item = cJSON_CreateObject(); diff --git a/iguana/exchanges/guistats b/iguana/exchanges/guistats new file mode 100755 index 000000000..98384f32a --- /dev/null +++ b/iguana/exchanges/guistats @@ -0,0 +1,3 @@ +#!/bin/bash +source userpass +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"statsdisp\",\"starttime\":0,\"endtime\":0,\"gui\":\"buildog\"}" diff --git a/iguana/exchanges/pubkeydisp b/iguana/exchanges/pubkeydisp new file mode 100755 index 000000000..6897c0a51 --- /dev/null +++ b/iguana/exchanges/pubkeydisp @@ -0,0 +1,3 @@ +#!/bin/bash +source userpass +curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"statsdisp\",\"starttime\":0,\"endtime\":0,\"pubkey\":\"a2593155464e37fcc88245780240a412a38cf3d316809445aad73f4e7789187d\"}"