From a5c27d5e7ec91ebee9b2b6595d18057071ef480a Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Oct 2017 00:08:17 +0300 Subject: [PATCH] Test --- iguana/exchanges/LP_ordermatch.c | 34 ++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/iguana/exchanges/LP_ordermatch.c b/iguana/exchanges/LP_ordermatch.c index a02bf2b84..52b5b1639 100644 --- a/iguana/exchanges/LP_ordermatch.c +++ b/iguana/exchanges/LP_ordermatch.c @@ -451,25 +451,29 @@ int32_t LP_nearest_utxovalue(struct iguana_info *coin,struct LP_address_utxo **u } for (i=0; ispendheight == 0 ) + if ( (up= utxos[i]) != 0 ) { - if ( coin->electrum != 0 ) + dist = (up->U.value - targetval); + printf("nearest i.%d target %.8f val %.8f dist %.8f mindist %.8f mini.%d spent.%d\n",i,dstr(targetval),dstr(up->U.value),dstr(dist),dstr(mindist),mini,up->spendheight); + if (up->spendheight == 0 ) { - if (up->SPV == 0 ) - up->SPV = LP_merkleproof(coin,backupep,up->U.txid,up->U.height); - printf("%s %s: SPV.%d\n",coin->symbol,bits256_str(str,up->U.txid),up->SPV); - if ( up->SPV < 0 ) + if ( coin->electrum != 0 ) { - printf("SPV failure for %s %s\n",coin->symbol,bits256_str(str,up->U.txid)); - continue; + if (up->SPV == 0 ) + up->SPV = LP_merkleproof(coin,backupep,up->U.txid,up->U.height); + printf("%s %s: SPV.%d\n",coin->symbol,bits256_str(str,up->U.txid),up->SPV); + if ( up->SPV < 0 ) + { + printf("SPV failure for %s %s\n",coin->symbol,bits256_str(str,up->U.txid)); + continue; + } + } + if ( dist >= 0 && dist < mindist ) + { + printf("(%.8f %.8f %.8f).%d ",dstr(up->U.value),dstr(dist),dstr(mindist),mini); + mini = i; + mindist = dist; } - } - dist = (up->U.value - targetval); - if ( dist >= 0 && dist < mindist ) - { - printf("(%.8f %.8f %.8f).%d ",dstr(up->U.value),dstr(dist),dstr(mindist),mini); - mini = i; - mindist = dist; } } }