diff --git a/iguana/exchanges/LP_utxos.c b/iguana/exchanges/LP_utxos.c index b160d2c64..d62f8aa0f 100644 --- a/iguana/exchanges/LP_utxos.c +++ b/iguana/exchanges/LP_utxos.c @@ -252,23 +252,20 @@ cJSON *LP_utxojson(struct LP_utxoinfo *utxo) char *LP_utxos(int32_t iambob,struct LP_peerinfo *mypeer,char *symbol,int32_t lastn) { int32_t i,firsti,n; struct LP_utxoinfo *utxo,*tmp; cJSON *utxosjson = cJSON_CreateArray(); - if ( symbol != 0 && symbol[0] != 0 ) + i = 0; + n = mypeer != 0 ? mypeer->numutxos : 0; + if ( lastn <= 0 ) + lastn = LP_PROPAGATION_SLACK * 2; + if ( lastn >= n ) + firsti = -1; + else firsti = (n - lastn); + HASH_ITER(hh,LP_utxoinfos[iambob],utxo,tmp) { - i = 0; - n = mypeer != 0 ? mypeer->numutxos : 0; - if ( lastn <= 0 ) - lastn = LP_PROPAGATION_SLACK * 2; - if ( lastn >= n ) - firsti = -1; - else firsti = (n - lastn); - HASH_ITER(hh,LP_utxoinfos[iambob],utxo,tmp) + if ( i++ < firsti ) + continue; + if ( (symbol == 0 || symbol[0] == 0 || strcmp(symbol,utxo->coin) == 0) && utxo->T.spentflag == 0 )//&& LP_ismine(utxo) > 0 ) { - if ( i++ < firsti ) - continue; - if ( (symbol == 0 || symbol[0] == 0 || strcmp(symbol,utxo->coin) == 0) && utxo->T.spentflag == 0 )//&& LP_ismine(utxo) > 0 ) - { - jaddi(utxosjson,LP_utxojson(utxo)); - } + jaddi(utxosjson,LP_utxojson(utxo)); } } return(jprint(utxosjson,1));