*Check if we have peers when doing a IPNS lookup and if not, force reset the peer defer, then await on it

This commit is contained in:
Derrick Hammer 2023-03-31 11:37:04 -04:00
parent fd2d66d2c4
commit bc10722539
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 6 additions and 0 deletions

View File

@ -304,6 +304,12 @@ async function handleIpnsResolve(aq: ActiveQuery) {
await activePeersDefer.promise; await activePeersDefer.promise;
if (PeerManager.instance.ipfs.libp2p.getPeers().length === 0) {
activePeersDefer = defer();
}
await activePeersDefer.promise;
if (!aq.callerInput || !("cid" in aq.callerInput)) { if (!aq.callerInput || !("cid" in aq.callerInput)) {
aq.reject("cid required"); aq.reject("cid required");
return; return;