Browse Source

#162 Check ETOMIC balance only when adding electrum server 1st time.

patch-5
Artem Pikulin 6 years ago
parent
commit
7e7e473bc5
  1. 9
      iguana/exchanges/LP_socket.c

9
iguana/exchanges/LP_socket.c

@ -1199,7 +1199,8 @@ void LP_dedicatedloop(void *arg)
cJSON *LP_electrumserver(struct iguana_info *coin,char *ipaddr,uint16_t port) cJSON *LP_electrumserver(struct iguana_info *coin,char *ipaddr,uint16_t port)
{ {
struct electrum_info *ep,*prev; int32_t kickval,already; cJSON *retjson,*array,*item; struct electrum_info *ep,*prev,*cur; int32_t kickval,already; cJSON *retjson,*array,*item;
cur = coin->electrum;
if ( ipaddr == 0 || ipaddr[0] == 0 || port == 0 ) if ( ipaddr == 0 || ipaddr[0] == 0 || port == 0 )
{ {
ep = coin->electrum; ep = coin->electrum;
@ -1278,14 +1279,12 @@ cJSON *LP_electrumserver(struct iguana_info *coin,char *ipaddr,uint16_t port)
} }
} }
#ifndef NOTETOMIC #ifndef NOTETOMIC
if (strcmp(coin->symbol, "ETOMIC") == 0) { if (coin->electrum != 0 && cur == 0 && strcmp(coin->symbol, "ETOMIC") == 0) {
cJSON *balance = cJSON_CreateObject(); cJSON *balance = cJSON_CreateObject();
electrum_address_getbalance(coin->symbol, ep, &balance, coin->smartaddr); electrum_address_getbalance(coin->symbol, coin->electrum, &balance, coin->smartaddr);
int64_t confirmed = get_cJSON_int(balance, "confirmed"); int64_t confirmed = get_cJSON_int(balance, "confirmed");
int64_t unconfirmed = get_cJSON_int(balance, "unconfirmed"); int64_t unconfirmed = get_cJSON_int(balance, "unconfirmed");
if ((confirmed + unconfirmed) < 20 * SATOSHIDEN && get_etomic_from_faucet(coin->smartaddr) != 1) { if ((confirmed + unconfirmed) < 20 * SATOSHIDEN && get_etomic_from_faucet(coin->smartaddr) != 1) {
coin->inactive = (uint32_t)time(NULL);
coin->electrum = ep->prev;
cJSON_Delete(balance); cJSON_Delete(balance);
return(cJSON_Parse("{\"error\":\"Could not get ETOMIC from faucet!\"}")); return(cJSON_Parse("{\"error\":\"Could not get ETOMIC from faucet!\"}"));
} }

Loading…
Cancel
Save