From 43a445509aed3ec617f626d33be2394f59bfc668 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 21 Sep 2017 23:18:24 +0200 Subject: [PATCH] Test --- iguana/exchanges/LP_ordermatch.c | 8 ++++---- iguana/exchanges/LP_utxos.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index d1f2e3f93..c24a163ac 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -485,7 +485,7 @@ struct LP_utxoinfo *LP_address_utxopair(struct LP_utxoinfo *utxo,struct LP_addre utxo->deposit.txid = up2->U.txid; utxo->deposit.vout = up2->U.vout; utxo->deposit.value = up2->U.value; - utxo->S.satoshis = SATOSHIDEN * ((volume + dstr(desttxfee)) / price); + utxo->S.satoshis = SATOSHIDEN * (volume / price); return(utxo); } } @@ -923,12 +923,12 @@ struct LP_utxoinfo *LP_buyutxo(struct LP_utxoinfo *bestutxo,double *ordermatchpr //printf("%s minvol %.8f %.8f maxvol %.8f\n",jprint(item,0),minvol,relvolume,maxvol); //if ( relvolume >= minvol && relvolume <= maxvol ) { - if ( (bestutxo= LP_address_utxopair(bestutxo,utxos,max,basecoin,coinaddr,txfee,dstr(bestutxo->S.satoshis * price - desttxfee),price,0,desttxfee)) != 0 ) + if ( (bestutxo= LP_address_utxopair(bestutxo,utxos,max,basecoin,coinaddr,txfee,dstr(autxo->S.satoshis),price,0,desttxfee)) != 0 ) { bestutxo->pubkey = pubp->pubkey; safecopy(bestutxo->gui,gui,sizeof(bestutxo->gui)); - autxo->S.satoshis = bestutxo->S.satoshis * price - desttxfee; - *bestsatoshisp = bestutxo->S.satoshis - txfee; + //autxo->S.satoshis = bestutxo->S.satoshis * price - desttxfee; + *bestsatoshisp = bestutxo->S.satoshis; *ordermatchpricep = price; *bestdestsatoshisp = autxo->S.satoshis; printf("ordermatch %.8f %.8f %.8f txfees (%.8f %.8f)\n",price,dstr(*bestsatoshisp),dstr(*bestdestsatoshisp),dstr(txfee),dstr(desttxfee)); diff --git a/iguana/exchanges/LP_utxos.c b/iguana/exchanges/LP_utxos.c index 479500d3c..0889cef7c 100644 --- a/iguana/exchanges/LP_utxos.c +++ b/iguana/exchanges/LP_utxos.c @@ -290,7 +290,7 @@ struct LP_utxoinfo *LP_utxo_bestfit(char *symbol,uint64_t destsatoshis) continue; if ( LP_isavailable(utxo) > 0 && LP_ismine(utxo) > 0 ) { - if ( utxo->S.satoshis >= destsatoshis/2 && (bestutxo == 0 || (bestutxo->S.satoshis < destsatoshis && utxo->S.satoshis >= destsatoshis) || (bestutxo->S.satoshis >= destsatoshis && utxo->S.satoshis < bestutxo->S.satoshis)) ) + if ( utxo->S.satoshis >= destsatoshis && (bestutxo == 0 || (bestutxo->S.satoshis < destsatoshis && utxo->S.satoshis >= destsatoshis) || (bestutxo->S.satoshis >= destsatoshis && utxo->S.satoshis < bestutxo->S.satoshis)) ) { if ( LP_iseligible(&srcvalue,&srcvalue2,utxo->iambob,symbol,utxo->payment.txid,utxo->payment.vout,utxo->S.satoshis,utxo->fee.txid,utxo->fee.vout) == 0 ) {