From 41f57c9ca67ffcb096c35ac2aff1015502b3ddae Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 1 Sep 2017 11:52:13 +0200 Subject: [PATCH] Bestflag --- iguana/exchanges/LP_ordermatch.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index e32930cda..3e3edf622 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -606,7 +606,7 @@ struct LP_utxoinfo *LP_bestutxo(double *ordermatchpricep,int64_t *bestsatoshisp, vout = jint(item,"vout"); vol = jdouble(item,"volume"); metric = price / bestprice; - if ( (butxo= LP_utxofind(1,txid,vout)) != 0 && (long long)(vol*SATOSHIDEN) == butxo->S.satoshis && LP_isavailable(butxo) > 0 && LP_ismine(butxo) == 0 )//&& butxo->T.bestflag == 0 ) + if ( (butxo= LP_utxofind(1,txid,vout)) != 0 && (long long)(vol*SATOSHIDEN) == butxo->S.satoshis && LP_isavailable(butxo) > 0 && LP_ismine(butxo) == 0 && butxo->T.bestflag == 0 ) { if ( LP_iseligible(&val,&val2,butxo->iambob,butxo->coin,butxo->payment.txid,butxo->payment.vout,butxo->S.satoshis,butxo->deposit.txid,butxo->deposit.vout) > 0 ) { @@ -662,6 +662,27 @@ struct LP_utxoinfo *LP_bestutxo(double *ordermatchpricep,int64_t *bestsatoshisp, break; } } + if ( bestutxo == 0 ) + { + int32_t numrestraints; + for (i=numrestraints=0; iT.bestflag = 0; + pubp->numerrors = 0; + } + } + } + printf("no bob utxo found -> cleared %d restraints\n",numrestraints); + } } free_json(orderbook); } @@ -669,6 +690,7 @@ struct LP_utxoinfo *LP_bestutxo(double *ordermatchpricep,int64_t *bestsatoshisp, } if ( bestutxo == 0 || *ordermatchpricep == 0. || *bestdestsatoshisp == 0 ) return(0); + bestutxo->T.bestflag = 1; int32_t changed; LP_mypriceset(&changed,autxo->coin,base,1. / *ordermatchpricep); return(bestutxo);