From 5b9d986c3b6b1851ebd347b17f3d0adfdff016e6 Mon Sep 17 00:00:00 2001 From: Claus-Peter Huebner Date: Wed, 24 May 2023 23:20:15 +0200 Subject: [PATCH] replace several usages of keyPair.publicKey.toString('hex') --- dht-node/src/dht_node/index.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/dht-node/src/dht_node/index.ts b/dht-node/src/dht_node/index.ts index 9d5d89edd..4fd0bd733 100644 --- a/dht-node/src/dht_node/index.ts +++ b/dht-node/src/dht_node/index.ts @@ -33,13 +33,12 @@ export const startDHT = async (topic: string): Promise => { try { const TOPIC = DHT.hash(Buffer.from(topic)) const keyPair = DHT.keyPair(getSeed()) - logger.info(`keyPairDHT: publicKey=${keyPair.publicKey.toString('hex')}`) + const pubKeyString = keyPair.publicKey.toString('hex') + logger.info(`keyPairDHT: publicKey=${pubKeyString}`) logger.debug(`keyPairDHT: secretKey=${keyPair.secretKey.toString('hex')}`) - await writeHomeCommunityEntry(keyPair.publicKey.toString('hex')) + await writeHomeCommunityEntry(pubKeyString) - const ownApiVersions = await writeFederatedHomeCommunityEntries( - keyPair.publicKey.toString('hex'), - ) + const ownApiVersions = await writeFederatedHomeCommunityEntries(pubKeyString) logger.info(`ApiList: ${JSON.stringify(ownApiVersions)}`) const node = new DHT({ keyPair }) @@ -146,7 +145,7 @@ export const startDHT = async (topic: string): Promise => { data.peers.forEach((peer: any) => { const pubKey = peer.publicKey.toString('hex') if ( - pubKey !== keyPair.publicKey.toString('hex') && + pubKey !== pubKeyString && !successfulRequests.includes(pubKey) && !errorfulRequests.includes(pubKey) && !collectedPubKeys.includes(pubKey)