diff --git a/iguana/exchanges/LP_include.h b/iguana/exchanges/LP_include.h index 0be95d830..2d0abd3c5 100644 --- a/iguana/exchanges/LP_include.h +++ b/iguana/exchanges/LP_include.h @@ -305,7 +305,7 @@ int32_t LP_mempoolscan(char *symbol,bits256 searchtxid); int32_t LP_txheight(struct iguana_info *coin,bits256 txid); int32_t LP_address_utxoadd(struct iguana_info *coin,char *coinaddr,bits256 txid,int32_t vout,uint64_t value,int32_t height,int32_t spendheight); cJSON *LP_address_utxos(struct iguana_info *coin,char *coinaddr,int32_t electrumret); -void LP_postutxos(char *symbol); +void LP_postutxos(char *symbol,char *coinaddr); uint16_t LP_randpeer(char *destip); diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index e90da1254..0f78716db 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -459,7 +459,7 @@ void LP_listunspent_issue(char *symbol,char *coinaddr) { if ( electrum_process_array(coin,coinaddr,retjson) != 0 ) { - LP_postutxos(symbol); // might be good to not saturate + LP_postutxos(symbol,coinaddr); // might be good to not saturate } } //printf("rand %s listunspent.(%s) to %s:%u -> %s\n",symbol,coinaddr,destip,destport,retstr); diff --git a/iguana/exchanges/LP_socket.c b/iguana/exchanges/LP_socket.c index 9a16f7134..a5204567c 100644 --- a/iguana/exchanges/LP_socket.c +++ b/iguana/exchanges/LP_socket.c @@ -470,7 +470,7 @@ cJSON *electrum_address_listunspent(char *symbol,struct electrum_info *ep,cJSON { //printf("%s %s LISTUNSPENT.(%s)\n",symbol,addr,jprint(retjson,0)); if ( electrum_process_array(coin,addr,retjson) != 0 ) - LP_postutxos(coin->symbol); + LP_postutxos(coin->symbol,addr); safecopy(coin->lastunspent,addr,sizeof(coin->lastunspent)); coin->unspenttime = (uint32_t)time(NULL); } diff --git a/iguana/exchanges/LP_utxo.c b/iguana/exchanges/LP_utxo.c index 6047fb853..f0b80a966 100644 --- a/iguana/exchanges/LP_utxo.c +++ b/iguana/exchanges/LP_utxo.c @@ -217,10 +217,10 @@ cJSON *LP_address_utxos(struct iguana_info *coin,char *coinaddr,int32_t electrum return(array); } -void LP_postutxos(char *symbol) +void LP_postutxos(char *symbol,char *coinaddr) { bits256 zero; char *msg; struct iguana_info *coin; cJSON *array,*reqjson = cJSON_CreateObject(); - if ( (coin= LP_coinfind(symbol)) != 0 && (array= LP_address_utxos(coin,coin->smartaddr,1)) != 0 ) + if ( (coin= LP_coinfind(symbol)) != 0 && (array= LP_address_utxos(coin,coinaddr,1)) != 0 ) { //printf("LP_postutxos pubsock.%d %s %s\n",pubsock,symbol,coin->smartaddr); if ( cJSON_GetArraySize(array) == 0 ) @@ -230,7 +230,7 @@ void LP_postutxos(char *symbol) memset(zero.bytes,0,sizeof(zero)); jaddstr(reqjson,"method","postutxos"); jaddstr(reqjson,"coin",symbol); - jaddstr(reqjson,"coinaddr",coin->smartaddr); + jaddstr(reqjson,"coinaddr",coinaddr); jadd(reqjson,"utxos",array); msg = jprint(reqjson,1); printf("post (%s) -> %d\n",msg,LP_mypubsock); diff --git a/iguana/exchanges/LP_utxos.c b/iguana/exchanges/LP_utxos.c index 76f302038..925354973 100644 --- a/iguana/exchanges/LP_utxos.c +++ b/iguana/exchanges/LP_utxos.c @@ -789,7 +789,7 @@ int32_t LP_privkey_init(int32_t mypubsock,struct iguana_info *coin,bits256 mypri } free_json(array); if ( flag != 0 ) - LP_postutxos(coin->symbol); + LP_postutxos(coin->symbol,coin->smartaddr); } //printf("privkey.%s %.8f\n",symbol,dstr(total)); return(flag); @@ -909,8 +909,8 @@ void LP_privkey_updates(void *ctx,int32_t pubsock,char *passphrase,int32_t inito privkey = LP_privkeycalc(ctx,pubkey33,&pubkey,coin,passphrase,""); if ( coin->inactive == 0 && initonly == 0 ) { - if ( LP_privkey_init(pubsock,coin,privkey,pubkey) > 0 || (rand() % 10) == 0 ) - LP_postutxos(coin->symbol); + if ( LP_privkey_init(pubsock,coin,privkey,pubkey) == 0 && (rand() % 10) == 0 ) + LP_postutxos(coin->symbol,coin->smartaddr); } } }