Fix silly filtering bug, add filtering for swarm nodes and lint

pull/316/head
Beaudan 6 years ago
parent 149a4d41f8
commit ee260f7de0

@ -283,7 +283,7 @@ class LokiMessageAPI {
options
);
return result.messages || [];
};
}
async startLongPolling(numConnections, callback) {
this.ourSwarmNodes = {};
@ -293,7 +293,9 @@ class LokiMessageAPI {
nodes = await lokiSnodeAPI.getSwarmNodesForPubKey(this.ourKey);
}
for (let i = 0; i < nodes.length; i += 1) {
const lastHash = await window.Signal.Data.getLastHashBySnode(nodes[i].address);
const lastHash = await window.Signal.Data.getLastHashBySnode(
nodes[i].address
);
this.ourSwarmNodes[nodes[i].address] = {
lastHash,
ip: nodes[i].ip,

@ -92,7 +92,7 @@ class LokiSnodeAPI {
);
// Filter 0.0.0.0 nodes which haven't submitted uptime proofs
const snodes = result.result.service_node_states.filter(
snode => snode.address !== '0.0.0.0'
snode => snode.public_ip !== '0.0.0.0'
);
this.randomSnodePool = snodes.map(snode => ({
address: snode.public_ip,
@ -172,7 +172,8 @@ class LokiSnodeAPI {
pubKey,
}
);
return result.snodes;
const snodes = result.snodes.filter(snode => snode.ip !== '0.0.0.0');
return snodes;
} catch (e) {
this.randomSnodePool = _.without(
this.randomSnodePool,

Loading…
Cancel
Save