From bad3ebf12611121fbf70590b88073c3a0c09fd70 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 5 Jun 2017 13:52:30 +0300 Subject: [PATCH] Test --- iguana/exchanges/LP_commands.c | 7 +++++-- iguana/exchanges/LP_rpc.c | 2 +- iguana/exchanges/LP_utxos.c | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 303cfd20d..9f0f55c7c 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -292,8 +292,11 @@ char *stats_JSON(cJSON *argjson,char *remoteaddr,uint16_t port) // from rpc port retstr = clonestr("{\"result\":\"success\",\"notify\":\"received\"}"); else if ( IAMCLIENT == 0 && strcmp(method,"notified") == 0 ) { - printf("utxonotify.(%s)\n",jprint(argjson,0)); - LP_addutxo(amclient,LP_mypeer,LP_mypubsock,jstr(argjson,"coin"),jbits256(argjson,"txid"),jint(argjson,"vout"),j64bits(argjson,"valuesats"),jbits256(argjson,"txid2"),jint(argjson,"vout2"),j64bits(argjson,"valuesats2"),jstr(argjson,"script"),jstr(argjson,"address"),jstr(argjson,"ipaddr"),juint(argjson,"port"),jdouble(argjson,"profit")); + if ( juint(argjson,"timestamp") > time(NULL)-60 ) + { + printf("utxonotify.(%s)\n",jprint(argjson,0)); + LP_addutxo(amclient,LP_mypeer,LP_mypubsock,jstr(argjson,"coin"),jbits256(argjson,"txid"),jint(argjson,"vout"),j64bits(argjson,"valuesats"),jbits256(argjson,"txid2"),jint(argjson,"vout2"),j64bits(argjson,"valuesats2"),jstr(argjson,"script"),jstr(argjson,"address"),jstr(argjson,"ipaddr"),juint(argjson,"port"),jdouble(argjson,"profit")); + } retstr = clonestr("{\"result\":\"success\",\"notifyutxo\":\"received\"}"); } if ( retstr != 0 ) diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index 7943cbc3c..395f197b1 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -52,7 +52,7 @@ char *issue_LP_notify(char *destip,uint16_t destport,char *ipaddr,uint16_t port, char *issue_LP_notifyutxo(char *destip,uint16_t destport,struct LP_utxoinfo *utxo) { char url[4096],str[65],str2[65]; - sprintf(url,"http://%s:%u/api/stats/notified?ipaddr=%s&port=%u&profit=%.6f&coin=%s&txid=%s&vout=%d&valuesats=%llu&txid2=%s&vout2=%d&valuesats2=%llu&script=%s&address=%s",destip,destport,utxo->ipaddr,utxo->port,utxo->profitmargin,utxo->coin,bits256_str(str,utxo->txid),utxo->vout,(long long)utxo->value,bits256_str(str2,utxo->txid2),utxo->vout2,(long long)utxo->value2,utxo->spendscript,utxo->coinaddr); + sprintf(url,"http://%s:%u/api/stats/notified?ipaddr=%s&port=%u&profit=%.6f&coin=%s&txid=%s&vout=%d&valuesats=%llu&txid2=%s&vout2=%d&valuesats2=%llu&script=%s&address=%s×tamp=%u",destip,destport,utxo->ipaddr,utxo->port,utxo->profitmargin,utxo->coin,bits256_str(str,utxo->txid),utxo->vout,(long long)utxo->value,bits256_str(str2,utxo->txid2),utxo->vout2,(long long)utxo->value2,utxo->spendscript,utxo->coinaddr,(uint32_t)time(NULL)); if ( strlen(url) > 1024 ) printf("WARNING long url.(%s)\n",url); return(issue_curl(url)); diff --git a/iguana/exchanges/LP_utxos.c b/iguana/exchanges/LP_utxos.c index efa52b2d3..055b37df3 100644 --- a/iguana/exchanges/LP_utxos.c +++ b/iguana/exchanges/LP_utxos.c @@ -32,6 +32,7 @@ struct LP_utxoinfo *LP_utxofind(bits256 txid,int32_t vout) cJSON *LP_inventoryjson(cJSON *item,struct LP_utxoinfo *utxo) { jaddstr(item,"coin",utxo->coin); + jaddnum(item,"now",time(NULL)); jaddstr(item,"address",utxo->coinaddr); jaddbits256(item,"txid",utxo->txid); jaddnum(item,"vout",utxo->vout); @@ -155,7 +156,7 @@ int32_t LP_utxosparse(int32_t amclient,struct LP_peerinfo *mypeer,int32_t mypubs for (i=0; i now-60 && (argipaddr= jstr(item,"ipaddr")) != 0 && (argport= juint(item,"port")) != 0 ) { if ( (pushport= juint(item,"push")) == 0 ) pushport = argport + 1;