*Buffer conversion bugfix

This commit is contained in:
Derrick Hammer 2022-11-28 00:31:37 -05:00
parent 77d72a6666
commit cb2299f9e8
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 3 additions and 1 deletions

View File

@ -21,7 +21,9 @@ export async function start() {
export async function getRpcByPeer(peer: Buffer | string) { export async function getRpcByPeer(peer: Buffer | string) {
const swarm = getSwarm(); 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)) { if (swarm._allConnections.has(peer)) {
return swarm._allConnections.get(peer)[RPC_PROTOCOL_SYMBOL]; return swarm._allConnections.get(peer)[RPC_PROTOCOL_SYMBOL];