Browse Source

Cache electrum tx history only when it's enabled explicitly in argjson.

This feature is used by AtomicDEX GUI only so I disable it by default.
blackjok3r
Artem Pikulin 6 years ago
parent
commit
444f1cd500
  1. 1
      iguana/exchanges/LP_commands.c
  2. 4
      iguana/exchanges/LP_include.h
  3. 2
      iguana/exchanges/LP_socket.c

1
iguana/exchanges/LP_commands.c

@ -717,6 +717,7 @@ version\n\
if ( (ptr= LP_coinsearch(coin)) != 0 )
{
ptr->inactive = 0;
ptr->cache_history = juint(argjson, "cache_history");
return(jprint(LP_electrumserver(ptr,jstr(argjson,"ipaddr"),juint(argjson,"port")),1));
} else return(clonestr("{\"error\":\"cant find coind\"}"));
}

4
iguana/exchanges/LP_include.h

@ -337,8 +337,9 @@ struct iguana_info
uint64_t txfee,do_autofill_merge;
int32_t numutxos,notarized,longestchain,firstrefht,firstscanht,lastscanht,height; uint16_t busport,did_addrutxo_reset;
uint32_t txversion,dPoWtime,lastautosplit,lastresetutxo,loadedcache,electrumlist,lastunspent,importedprivkey,lastpushtime,lastutxosync,addr_listunspent_requested,lastutxos,updaterate,counter,inactive,lastmempool,lastgetinfo,ratetime,heighttime,lastmonitor,obooktime;
uint8_t pubtype,p2shtype,isPoS,wiftype,wiftaddr,taddr,noimportprivkey_flag,userconfirms,isassetchain,maxconfirms;
uint8_t pubtype,p2shtype,isPoS,wiftype,wiftaddr,taddr,noimportprivkey_flag,userconfirms,isassetchain,maxconfirms,cache_history;
char symbol[128],smartaddr[64],userpass[1024],serverport[128],instantdex_address[64],estimatefeestr[32],getinfostr[32],etomic[64],validateaddress[64];
struct LP_tx_history_item *tx_history;
// portfolio
double price_kmd,force,perc,goal,goalperc,relvolume,rate;
void *electrum; void *ctx;
@ -348,7 +349,6 @@ struct iguana_info
void *curl_handle; portable_mutex_t curl_mutex;
bits256 cachedtxid,notarizationtxid; uint8_t *cachedtxiddata; int32_t cachedtxidlen;
bits256 cachedmerkle,notarizedhash; int32_t cachedmerkleheight;
struct LP_tx_history_item *tx_history;
};
struct _LP_utxoinfo { bits256 txid; uint64_t value; int32_t height; uint32_t vout:30,suppress:1,pad:1; };

2
iguana/exchanges/LP_socket.c

@ -1502,7 +1502,7 @@ cJSON *LP_electrumserver(struct iguana_info *coin,char *ipaddr,uint16_t port)
cJSON_Delete(balance);
}
#endif
if (coin->electrum != 0 && cur == 0) {
if (coin->cache_history > 0 && coin->electrum != 0 && cur == 0) {
if ( OS_thread_create(malloc(sizeof(pthread_t)),NULL,(void *)LP_electrum_txhistory_loop,(void *)coin) != 0 )
{
printf("error launching LP_electrum_tx_history_loop %s.(%s:%u)\n",coin->symbol,ep->ipaddr,ep->port);

Loading…
Cancel
Save