Browse Source

#97 Do not request ETOMIC from faucet if balance >= 20.

pass-iguana-arg
Artem Pikulin 7 years ago
parent
commit
38bf61e56c
  1. 11
      iguana/exchanges/LP_commands.c
  2. 16
      iguana/exchanges/LP_socket.c

11
iguana/exchanges/LP_commands.c

@ -613,7 +613,7 @@ version\n\
return(jprint(retjson,1));
}
#ifndef NOTETOMIC
if (strcmp(coin, "ETOMIC") == 0) {
if (strcmp(coin, "ETOMIC") == 0 && LP_RTsmartbalance(ptr) < 20 * SATOSHIDEN) {
if (get_etomic_from_faucet(ptr->smartaddr) != 1) {
return(clonestr("{\"error\":\"Could not get ETOMIC from faucet!\"}"));
}
@ -641,8 +641,6 @@ version\n\
{
cJSON *array;
ptr->inactive = 0;
if ( ptr->smartaddr[0] != 0 )
LP_unspents_load(coin,ptr->smartaddr);
LP_unspents_load(coin,ptr->smartaddr);
if ( strcmp(ptr->symbol,"KMD") == 0 )
LP_importaddress("KMD",BOTS_BONDADDRESS);
@ -708,13 +706,6 @@ version\n\
{
if ( (ptr= LP_coinsearch(coin)) != 0 )
{
#ifndef NOTETOMIC
if (strcmp(coin, "ETOMIC") == 0) {
if (get_etomic_from_faucet(ptr->smartaddr) != 1) {
return(clonestr("{\"error\":\"Could not get ETOMIC from faucet!\"}"));
}
}
#endif
ptr->inactive = 0;
return(jprint(LP_electrumserver(ptr,jstr(argjson,"ipaddr"),juint(argjson,"port")),1));
} else return(clonestr("{\"error\":\"cant find coind\"}"));

16
iguana/exchanges/LP_socket.c

@ -1277,7 +1277,21 @@ cJSON *LP_electrumserver(struct iguana_info *coin,char *ipaddr,uint16_t port)
jaddnum(retjson,"restart",kickval);
}
}
#ifndef NOTETOMIC
if (strcmp(coin->symbol, "ETOMIC") == 0) {
cJSON *balance = cJSON_CreateObject();
electrum_address_getbalance(coin->symbol, ep, &balance, coin->smartaddr);
int64_t confirmed = get_cJSON_int(balance, "confirmed");
int64_t unconfirmed = get_cJSON_int(balance, "unconfirmed");
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);
return(cJSON_Parse("{\"error\":\"Could not get ETOMIC from faucet!\"}"));
}
cJSON_Delete(balance);
}
#endif
//printf("(%s)\n",jprint(retjson,0));
return(retjson);
}

Loading…
Cancel
Save