jl777 7 years ago
parent
commit
f66f3b9745
  1. 3
      iguana/exchanges/LP_instantdex.c
  2. 13
      iguana/exchanges/LP_utxo.c

3
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));

13
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);
}

Loading…
Cancel
Save