Skip to content

Commit 23dbb75

Browse files
committed
cache electrum list
1 parent ad4acb9 commit 23dbb75

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

assets_js_bitrequest_rpcs.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ function fetch_electrum_nodes(currency, node_url, predefined_nodes, custom_nodes
156156
list_length = result.length;
157157
let done = false;
158158
if (list_length && is_array(result)) {
159-
const short_list = (list_length > 75) ? result.slice(0, 75) : result;
159+
const short_list = (list_length > 75) ? result.slice(0, 75) : result,
160+
short_list_length = short_list.length;
160161
$.each(short_list, function(node_id, nd) {
161162
const url = nd[1] || nd[0],
162163
filter_ips = is_valid_ipv4(url);
@@ -211,7 +212,7 @@ function fetch_electrum_nodes(currency, node_url, predefined_nodes, custom_nodes
211212
}
212213
}).always(function() {
213214
if (done) return;
214-
const count = list_length - node_id;
215+
const count = short_list_length - node_id;
215216
if (count === 1 || count === 2 || count === 3) { // some margin for flexibility
216217
done = true;
217218
const margin_timeout = setTimeout(function() {

0 commit comments

Comments
 (0)