From bafad249cf2f7d218d117c8917fd3804323ffda7 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 6 Oct 2017 20:11:55 +0300 Subject: [PATCH] Test --- iguana/exchanges/LP_nativeDEX.c | 5 +---- iguana/exchanges/LP_ordermatch.c | 8 ++++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 03759b69b..542b1e24a 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -20,16 +20,13 @@ // marketmaker // // new features: -// better error message in ordermatch -// withdraw // sign packets -// require spv validated for using in trades // dPoW security +// withdraw // stats, fix pricearray // verify portfolio // bittrex balancing -// -check for completed one being spent #include #include "LP_include.h" diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index f398f277d..4083fdb6c 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -441,12 +441,12 @@ int32_t LP_nanobind(void *ctx,char *pairstr) return(pairsock); } -int32_t LP_nearest_utxovalue(struct LP_address_utxo **utxos,int32_t n,uint64_t targetval) +int32_t LP_nearest_utxovalue(int32_t noSPV,struct LP_address_utxo **utxos,int32_t n,uint64_t targetval) { int32_t i,mini = -1; int64_t dist; uint64_t mindist = (1LL << 60); for (i=0; ispendheight == 0 && utxos[i]->SPV > 0 ) + if ( utxos[i] != 0 && (noSPV != 0 || (utxos[i]->spendheight == 0 && utxos[i]->SPV > 0)) ) { dist = (utxos[i]->U.value - targetval); if ( dist >= 0 && dist < mindist ) @@ -484,12 +484,12 @@ struct LP_utxoinfo *LP_address_utxopair(int32_t iambob,struct LP_address_utxo ** printf("targetval %.8f vol %.8f price %.8f txfee %.8f %s\n",dstr(targetval),relvolume,price,dstr(txfee),coinaddr); } mini = -1; - if ( targetval != 0 && (mini= LP_nearest_utxovalue(utxos,m,targetval)) >= 0 && (double)utxos[mini]->U.value/targetval < LP_MINVOL-1 ) + if ( targetval != 0 && (mini= LP_nearest_utxovalue(coin->electrum == 0,utxos,m,targetval)) >= 0 && (double)utxos[mini]->U.value/targetval < LP_MINVOL-1 ) { up = utxos[mini]; utxos[mini] = 0; targetval2 = (targetval / 8) * 9 + 2*txfee; - if ( (mini= LP_nearest_utxovalue(utxos,m,targetval2)) >= 0 ) + if ( (mini= LP_nearest_utxovalue(coin->electrum == 0,utxos,m,targetval2)) >= 0 ) { if ( up != 0 && (up2= utxos[mini]) != 0 ) {