jl777 7 years ago
parent
commit
40a013fe43
  1. 13
      iguana/exchanges/LP_rpc.c

13
iguana/exchanges/LP_rpc.c

@ -598,7 +598,7 @@ int32_t LP_importaddress(char *symbol,char *address)
double _LP_getestimatedrate(struct iguana_info *coin) double _LP_getestimatedrate(struct iguana_info *coin)
{ {
char buf[512],*retstr; cJSON *errjson; double rate = 0.00000020; char buf[512],*retstr; cJSON *errjson; double rate = 0.00000020;
if ( coin->rate == 0. || time(NULL) > coin->ratetime+30 ) if ( time(NULL) > coin->ratetime+30 )
{ {
sprintf(buf,"[%d]",strcmp(coin->symbol,"BTC") == 0 ? 6 : 2); sprintf(buf,"[%d]",strcmp(coin->symbol,"BTC") == 0 ? 6 : 2);
if ( (retstr= LP_apicall(coin,coin->electrum==0?"estimatefee" : "blockchain.estimatefee",buf)) != 0 ) if ( (retstr= LP_apicall(coin,coin->electrum==0?"estimatefee" : "blockchain.estimatefee",buf)) != 0 )
@ -623,7 +623,7 @@ double _LP_getestimatedrate(struct iguana_info *coin)
} }
free(retstr); free(retstr);
} }
} } else rate = coin->rate;
return(rate); return(rate);
} }
@ -632,12 +632,9 @@ double LP_getestimatedrate(struct iguana_info *coin)
double rate = 0.00000020; double rate = 0.00000020;
if ( coin == 0 ) if ( coin == 0 )
return(0.0001); return(0.0001);
if ( coin->txfee == 0 || coin->rate == 0. || time(NULL) > coin->ratetime+600 ) if ( (rate= _LP_getestimatedrate(coin)) != 0. )
{ coin->txfee = LP_AVETXSIZE * (coin->rate * SATOSHIDEN);
rate = _LP_getestimatedrate(coin); else rate = dstr(coin->txfee) / LP_AVETXSIZE;
if ( rate != 0. )
coin->txfee = SATOSHIDEN * (coin->rate * LP_AVETXSIZE);
} else return((double)coin->txfee / (LP_AVETXSIZE * SATOSHIDEN));
return(SATOSHIDEN * rate); return(SATOSHIDEN * rate);
} }

Loading…
Cancel
Save