Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 87d6e9a

Browse files
committed
refactor: use peer id bytes instead of computing it again
1 parent a0b5083 commit 87d6e9a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/core/components/init.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ module.exports = function init (self) {
108108
cb(null, true)
109109
}
110110
},
111-
// Setup offline routing for IPNS. This is primarily used for offline ipns modifications, such as the initializeKeyspace feature.
111+
// Setup the offline routing for IPNS.
112+
// This is primarily used for offline ipns modifications, such as the initializeKeyspace feature.
112113
(_, cb) => {
113114
const offlineDatastore = new OfflineDatastore(self._repo)
114115

src/core/ipns/resolver.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict'
22

33
const ipns = require('ipns')
4-
const { fromB58String } = require('multihashes')
54
const Record = require('libp2p-record').Record
65
const PeerId = require('peer-id')
76
const errcode = require('err-code')
@@ -91,7 +90,7 @@ class IpnsResolver {
9190
// resolve ipns entries from the provided routing
9291
_resolveName (name, callback) {
9392
const peerId = PeerId.createFromB58String(name)
94-
const { routingKey } = ipns.getIdKeys(fromB58String(name))
93+
const { routingKey } = ipns.getIdKeys(peerId.toBytes())
9594

9695
// TODO DHT - get public key from routing?
9796
// https://github.com/ipfs/go-ipfs/blob/master/namesys/routing.go#L70

0 commit comments

Comments
 (0)