From 47366177ac07ff44abe17f492217752d12a148d2 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 17:38:06 +0300 Subject: [PATCH] Test --- iguana/exchanges/LP_include.h | 2 +- iguana/exchanges/LP_nativeDEX.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_include.h b/iguana/exchanges/LP_include.h index 46bdd0710..0808149cc 100644 --- a/iguana/exchanges/LP_include.h +++ b/iguana/exchanges/LP_include.h @@ -37,7 +37,7 @@ #define LP_GETINFO_INCR 30 #define LP_ORDERBOOK_DURATION 3600 -#define LP_HTTP_TIMEOUT 5 // 1 is too small due to edge cases of time(NULL) +#define LP_HTTP_TIMEOUT 3 // 1 is too small due to edge cases of time(NULL) #define LP_MAXPEER_ERRORS 3 #define LP_MINPEER_GOOD 20 #define LP_PEERGOOD_ERRORDECAY 0.9 diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 923f18977..de434d70e 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -318,6 +318,31 @@ void command_rpcloop(void *myipaddr) } } +void LP_smartutxos_push(struct iguana_info *coin) +{ + struct LP_peerinfo *peer,*tmp; uint64_t value; bits256 txid; int32_t i,vout,height,n; char *retstr; cJSON *array,*item; + if ( (array= LP_address_utxos(coin,coin->smartaddr,1)) != 0 ) + { + if ( (n= cJSON_GetArraySize(array)) > 0 ) + { + for (i=0; iipaddr,peer->port,coin->symbol,coin->smartaddr,txid,vout,height,value)) != 0 ) + free(retstr); + } + } + } + free_json(array); + } +} + int32_t LP_utxos_sync(struct LP_peerinfo *peer) { int32_t i,j,n=0,m,v,posted=0; bits256 txid; cJSON *array,*item,*item2,*array2,*array3; uint64_t total,total2,metric; struct iguana_info *coin,*ctmp; struct LP_address *ap; char *retstr,*retstr2,*coinaddr; @@ -463,6 +488,7 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int } if ( peer->diduquery == 0 ) { + needpings++; LP_peer_pricesquery(peer); LP_utxos_sync(peer); peer->diduquery = now; @@ -479,6 +505,10 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int { //printf("needpings.%d send notify\n",needpings); LP_notify_pubkeys(ctx,pubsock); + HASH_ITER(hh,LP_coins,coin,ctmp) + { + LP_smartutxos_push(coin); + } } if ( (counter % 6000) == 10 ) {