diff --git a/iguana/exchanges/LP_cache.c b/iguana/exchanges/LP_cache.c index bcca92a86..660ff107c 100644 --- a/iguana/exchanges/LP_cache.c +++ b/iguana/exchanges/LP_cache.c @@ -115,7 +115,7 @@ int32_t LP_cacheitem(struct iguana_info *coin,FILE *fp) hash = bits256_doublesha256(0,serialized,len); if ( bits256_cmp(hash,txid) == 0 ) { - printf("%s validated in cache\n",bits256_str(str,hash)); + //printf("%s validated in cache\n",bits256_str(str,hash)); if ( (txobj= LP_create_transaction(coin,txid,serialized,len,height)) != 0 ) free_json(txobj); return((int32_t)(ftell(fp) - fpos)); @@ -128,10 +128,10 @@ int32_t LP_cacheitem(struct iguana_info *coin,FILE *fp) void LP_cacheptrs_init(struct iguana_info *coin) { - char fname[1024]; FILE *fp; int32_t tflag=0; long n,fsize=0,len = 0; + char fname[1024]; FILE *fp; int32_t count,tflag=0; long n,fsize=0,len = 0; sprintf(fname,"%s/UNSPENTS/%s.SPV",GLOBAL_DBDIR,coin->symbol), OS_portable_path(fname); fp = fopen(fname,"rb"); - printf("load %s\n",fname); + count = 0; if ( fp != 0 ) { fseek(fp,0,SEEK_END); @@ -145,9 +145,10 @@ void LP_cacheptrs_init(struct iguana_info *coin) tflag = 1; break; } + count++; len += n; - printf("%s len.%ld n.%ld\n",fname,len,n); } + printf("loaded %s %d entries total len.%ld\n",fname,count,len); fclose(fp); } else printf("couldnt find.(%s)\n",fname); if ( tflag != 0 ) diff --git a/iguana/exchanges/LP_include.h b/iguana/exchanges/LP_include.h index 61749e7ff..08f82f182 100644 --- a/iguana/exchanges/LP_include.h +++ b/iguana/exchanges/LP_include.h @@ -263,7 +263,7 @@ struct iguana_info portable_mutex_t txmutex,addrmutex; struct LP_transaction *transactions; struct LP_address *addresses; uint64_t txfee; int32_t numutxos,longestchain,firstrefht,firstscanht,lastscanht,bussock,height; uint16_t busport; - uint32_t electrumlist,lastunspent,importedprivkey,lastpushtime,lastutxosync,addr_listunspent_requested,lastutxos,updaterate,counter,inactive,lastmempool,lastgetinfo,ratetime,heighttime,lastmonitor,obooktime; + uint32_t 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; char symbol[16],smartaddr[64],userpass[1024],serverport[128]; // portfolio diff --git a/iguana/exchanges/LP_socket.c b/iguana/exchanges/LP_socket.c index 8435aa6df..9c816046a 100644 --- a/iguana/exchanges/LP_socket.c +++ b/iguana/exchanges/LP_socket.c @@ -1056,9 +1056,13 @@ cJSON *LP_electrumserver(struct iguana_info *coin,char *ipaddr,uint16_t port) { printf("launched %s electrum.(%s:%u)\n",coin->symbol,ep->ipaddr,ep->port); jaddstr(retjson,"result","success"); - if ( (ep->prev= coin->electrum) == 0 ) - LP_cacheptrs_init(coin); + ep->prev = coin->electrum; coin->electrum = ep; + if ( coin->loadedcache == 0 ) + { + LP_cacheptrs_init(coin); + coin->loadedcache = (uint32_t)time(NULL); + } } } else