From f66f3b974555be9238f0cb5b3cfa513232a69c37 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 4 Apr 2018 16:13:25 +0300 Subject: [PATCH] Test --- iguana/exchanges/LP_instantdex.c | 3 +-- iguana/exchanges/LP_utxo.c | 13 ++++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/iguana/exchanges/LP_instantdex.c b/iguana/exchanges/LP_instantdex.c index c76bc5457..96604e439 100644 --- a/iguana/exchanges/LP_instantdex.c +++ b/iguana/exchanges/LP_instantdex.c @@ -457,10 +457,9 @@ int32_t LP_claim_submit(void *ctx,cJSON *txids,int64_t *sump,struct iguana_info else { interest = dstr(LP_komodo_interest(utxotxid,satoshis)); - satoshis += interest; } jaddnum(item,"interest",interest)); - //printf("%.8f %.8f %.8f\n",dstr(satoshis),dstr(LP_value_extract(vout0,0)),dstr(LP_komodo_interest(utxotxid,satoshis))); + printf("%.8f %.8f %.8f\n",dstr(satoshis),dstr(LP_value_extract(vout0,0)),dstr(LP_komodo_interest(utxotxid,satoshis))); if ( claimtime <= expiration ) { printf("iter.%d j.%d claimtime.%u vs %u, wait %d seconds to %s claim %.8f\n",iter,j,claimtime,expiration,(int32_t)expiration-claimtime,bits256_str(str,utxotxid),dstr(satoshis)); diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index ee2a8a336..b822dbcb9 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -208,8 +208,11 @@ int32_t LP_nearestvalue(int32_t iambob,uint64_t *values,int32_t n,uint64_t targe uint64_t LP_value_extract(cJSON *obj,int32_t addinterest) { - double val = 0.; uint64_t value = 0; int32_t electrumflag; + double val = 0.; uint64_t value = 0; int32_t electrumflag; bits256 txid; electrumflag = (jobj(obj,"tx_hash") != 0); + if ( electrumflag != 0 ) + txid = jbits256(obj,"tx_hash"); + else txid = jbits256(obj,"txid"); if ( electrumflag == 0 ) { if ( (val= jdouble(obj,"amount")) < SMALLVAL ) @@ -218,8 +221,12 @@ uint64_t LP_value_extract(cJSON *obj,int32_t addinterest) } else value = j64bits(obj,"value"); if ( value != 0 ) { - if ( addinterest != 0 && jobj(obj,"interest") != 0 ) - value += (jdouble(obj,"interest") * SATOSHIDEN); + if ( addinterest != 0 ) + { + if ( jobj(obj,"interest") != 0 ) + value += (jdouble(obj,"interest") * SATOSHIDEN); + else value += LP_komodo_interest(txid,value); + } } return(value); }