From 823c2f663e1414977c288ec6b21986a48b463aa4 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 15 Mar 2018 21:37:36 +0200 Subject: [PATCH] Test --- iguana/exchanges/LP_ordermatch.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index 7a92efd86..6593ea6a9 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -1443,7 +1443,7 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson, char *LP_autobuy(void *ctx,char *myipaddr,int32_t mypubsock,char *base,char *rel,double maxprice,double relvolume,int32_t timeout,int32_t duration,char *gui,uint32_t nonce,bits256 destpubkey,uint32_t tradeid) { - uint64_t desttxfee,txfee; uint32_t lastnonce; int64_t bestsatoshis=0,destsatoshis; struct iguana_info *basecoin,*relcoin; struct LP_utxoinfo *autxo,B,A; struct LP_quoteinfo Q; bits256 pubkeys[100]; struct LP_address_utxo *utxos[1000]; int32_t i,max=(int32_t)(sizeof(utxos)/sizeof(*utxos)); + uint64_t desttxfee,txfee; uint32_t lastnonce; int64_t bestsatoshis=0,destsatoshis; struct iguana_info *basecoin,*relcoin; struct LP_utxoinfo *autxo,B,A; struct LP_quoteinfo Q; bits256 pubkeys[100]; struct LP_address_utxo *utxos[1000]; int32_t maxiters=50,i,max=(int32_t)(sizeof(utxos)/sizeof(*utxos)); basecoin = LP_coinfind(base); relcoin = LP_coinfind(rel); if ( gui == 0 ) @@ -1490,14 +1490,16 @@ char *LP_autobuy(void *ctx,char *myipaddr,int32_t mypubsock,char *base,char *rel destsatoshis = SATOSHIDEN * relvolume + 2*desttxfee; LP_address_utxo_reset(relcoin); autxo = 0; - for (i=0; i<50; i++) + for (i=0; ismartaddr,txfee,dstr(destsatoshis),maxprice,desttxfee)) != 0 ) break; destsatoshis *= 0.99; + if ( destsatoshis < desttxfee*LP_MINSIZE_TXFEEMULT ) + break; } - if ( i == 50 && autxo == 0 ) + if ( destsatoshis < desttxfee*LP_MINSIZE_TXFEEMULT || i == maxiters ) { return(clonestr("{\"error\":\"cant find a deposit that is close enough in size. make another deposit that is just a bit larger than what you want to trade\"}")); }