diff --git a/iguana/exchanges/LP_include.h b/iguana/exchanges/LP_include.h index 38f8b1393..cbbd765ec 100644 --- a/iguana/exchanges/LP_include.h +++ b/iguana/exchanges/LP_include.h @@ -247,7 +247,7 @@ struct iguana_info portable_mutex_t txmutex,addrmutex; struct LP_transaction *transactions; struct LP_address *addresses; uint64_t txfee; int32_t longestchain,firstrefht,firstscanht,lastscanht,bussock,height; uint16_t busport; - uint32_t lastpushtime,lastutxosync,addr_listunspent_requested,lastutxos,updaterate,counter,inactive,lastmempool,lastgetinfo,ratetime,heighttime,lastmonitor,obooktime; + uint32_t 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_utxos.c b/iguana/exchanges/LP_utxos.c index 45dc9c614..590ebcb30 100644 --- a/iguana/exchanges/LP_utxos.c +++ b/iguana/exchanges/LP_utxos.c @@ -733,18 +733,19 @@ bits256 LP_privkeycalc(void *ctx,uint8_t *pubkey33,bits256 *pubkeyp,struct iguan userpub = curve25519(userpass,curve25519_basepoint9()); printf("userpass.(%s)\n",bits256_str(G.USERPASS,userpub)); } - if ( coin->electrum == 0 && coin->userpass[0] != 0 ) + } + if ( coin->importedprivkey == 0 && coin->electrum == 0 && coin->userpass[0] != 0 && LP_getheight(coin) > 0 ) + { + LP_listunspent_issue(coin->symbol,coin->smartaddr,0); + if ( (retjson= LP_importprivkey(coin->symbol,tmpstr,coin->smartaddr,-1)) != 0 ) { - LP_listunspent_issue(coin->symbol,coin->smartaddr,0); - if ( (retjson= LP_importprivkey(coin->symbol,tmpstr,coin->smartaddr,-1)) != 0 ) + if ( jobj(retjson,"error") != 0 ) { - if ( jobj(retjson,"error") != 0 ) - { - printf("cant importprivkey.%s -> (%s), abort session\n",coin->symbol,jprint(retjson,1)); - exit(-1); - } - } else free_json(retjson); - } + printf("cant importprivkey.%s -> (%s), abort session\n",coin->symbol,jprint(retjson,1)); + exit(-1); + } + } else free_json(retjson); + coin->importedprivkey = (uint32_t)time(NULL); } vcalc_sha256(0,checkkey.bytes,privkey.bytes,sizeof(privkey)); checkkey.bytes[0] &= 248, checkkey.bytes[31] &= 127, checkkey.bytes[31] |= 64;