Compare commits

..

2 Commits

1 changed files with 5 additions and 3 deletions

View File

@ -20,7 +20,7 @@ let swarm;
let proxy: HandshakeProxy; let proxy: HandshakeProxy;
function resolveWithPeers(resolve: Function) { function resolveWithPeers(resolve: Function) {
if (proxy.node.peers.list.size === 0) { if (!proxy.node.pool.peers.head()) {
proxy.node.pool.once("peer", () => { proxy.node.pool.once("peer", () => {
resolve(null); resolve(null);
}); });
@ -48,14 +48,16 @@ async function handleReady(aq: ActiveQuery) {
return resolveWithPeers(resolve); return resolveWithPeers(resolve);
} }
proxy.node.pool.on("full", resolveWithPeers); proxy.node.pool.once("full", () => {
resolveWithPeers(resolve);
});
}); });
aq.respond(); aq.respond();
} }
async function handleQuery(aq: ActiveQuery) { async function handleQuery(aq: ActiveQuery) {
if (!proxy.node.chain.synced || proxy.node.peers.list.size === 0) { if (!proxy.node.chain.synced || !proxy.node.pool.peers.head()) {
aq.reject("not ready"); aq.reject("not ready");
return; return;
} }