From 52b6672cc4c77e0937192f01e35f4dab3eba801c Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 26 Sep 2017 18:20:17 +0200 Subject: [PATCH] Test --- iguana/exchanges/LP_nativeDEX.c | 2 ++ iguana/exchanges/LP_ordermatch.c | 2 +- iguana/exchanges/LP_rpc.c | 3 +-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index ef54689e0..1d93e3540 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -361,6 +361,8 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int memset(&zero,0,sizeof(zero)); if ( coin->inactive != 0 ) continue; + if ( coin->rate == 0. ) + LP_getestimatedrate(coin); if ( (rand() % 1000) == 0 ) { post = 0; diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 4ef246c55..9dc4c0eaa 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -460,7 +460,7 @@ int32_t LP_nearest_utxovalue(struct LP_address_utxo **utxos,int32_t n,uint64_t t uint64_t LP_basesatoshis(double relvolume,double price,uint64_t txfee,uint64_t desttxfee) { printf("basesatoshis %.8f (rel %.8f / price %.8f)\n",dstr(SATOSHIDEN * ((relvolume + dstr(desttxfee)) / price) + 2*txfee),relvolume,price); - if ( relvolume > dstr(desttxfee) ) + if ( relvolume > dstr(desttxfee) && price > SMALLVAL ) return(SATOSHIDEN * ((relvolume - dstr(desttxfee)) / price)); else return(0); } diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index 837294e64..90a40581f 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -617,8 +617,7 @@ double LP_getestimatedrate(struct iguana_info *coin) rate *= 1.25; coin->rate = rate; coin->ratetime = (uint32_t)time(NULL); - if ( (rand() % 10) == 0 ) - printf("estimated rate.(%s) (%s) -> %.8f\n",coin->symbol,retstr,rate); + printf("estimated rate.(%s) (%s) -> %.8f\n",coin->symbol,retstr,rate); } free(retstr); }