From cb2299f9e810f950be22ff10cbb64eb22b7b283b Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Mon, 28 Nov 2022 00:31:37 -0500 Subject: [PATCH] *Buffer conversion bugfix --- src/modules/rpc.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modules/rpc.ts b/src/modules/rpc.ts index 9b22a33..f4889b7 100644 --- a/src/modules/rpc.ts +++ b/src/modules/rpc.ts @@ -21,7 +21,9 @@ export async function start() { export async function getRpcByPeer(peer: Buffer | string) { const swarm = getSwarm(); - peer = b4a.from(peer) as Buffer; + if (!b4a.isBuffer(peer)) { + peer = b4a.from(peer, "hex") as Buffer; + } if (swarm._allConnections.has(peer)) { return swarm._allConnections.get(peer)[RPC_PROTOCOL_SYMBOL];