jl777 7 years ago
parent
commit
52690233a3
  1. 6
      iguana/exchanges/LP_ordermatch.c
  2. 11
      iguana/exchanges/LP_rpc.c

6
iguana/exchanges/LP_ordermatch.c

@ -26,11 +26,11 @@ uint64_t LP_txfeecalc(struct iguana_info *coin,uint64_t txfee)
if ( strcmp(coin->symbol,"BTC") == 0 ) if ( strcmp(coin->symbol,"BTC") == 0 )
{ {
coin->rate = LP_getestimatedrate(coin); coin->rate = LP_getestimatedrate(coin);
if ( (txfee= coin->rate * LP_AVETXSIZE) <= LP_MIN_TXFEE ) if ( (txfee= SATOSHIDEN * coin->rate * LP_AVETXSIZE) <= LP_MIN_TXFEE )
{ {
coin->rate = 0.; coin->rate = -1.;
coin->rate = _LP_getestimatedrate(coin); coin->rate = _LP_getestimatedrate(coin);
if ( (txfee= coin->rate * LP_AVETXSIZE) <= LP_MIN_TXFEE ) if ( (txfee= SATOSHIDEN * coin->rate * LP_AVETXSIZE) <= LP_MIN_TXFEE )
txfee = LP_MIN_TXFEE; txfee = LP_MIN_TXFEE;
} }
} else txfee = coin->txfee; } else txfee = coin->txfee;

11
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 ( time(NULL) > coin->ratetime+30 ) if ( coin->rate < 0. || 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 )
@ -631,11 +631,10 @@ 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(rate);
if ( (rate= _LP_getestimatedrate(coin)) != 0. ) if ( (rate= _LP_getestimatedrate(coin)) <= 0. )
coin->txfee = LP_AVETXSIZE * (coin->rate * SATOSHIDEN); rate = dstr(coin->txfee) / LP_AVETXSIZE;
else rate = dstr(coin->txfee) / LP_AVETXSIZE; return(rate);
return(SATOSHIDEN * rate);
} }
char *LP_sendrawtransaction(char *symbol,char *signedtx) char *LP_sendrawtransaction(char *symbol,char *signedtx)

Loading…
Cancel
Save