diff --git a/src/rpcQuery.ts b/src/rpcQuery.ts index 31e9f07..917684f 100644 --- a/src/rpcQuery.ts +++ b/src/rpcQuery.ts @@ -63,7 +63,16 @@ export default class RpcQuery { } private async queryRelay(relay: string): Promise { - const socket = this._network.dht.connect(Buffer.from(relay, "hex")); + let socket: any; + + try { + socket = this._network.dht.connect(Buffer.from(relay, "hex")); + if (isPromise(socket)) { + socket = await socket; + } + } catch (e) { + return; + } return new Promise((resolve, reject) => { socket.on("data", (res: Buffer) => { socket.end();