diff --git a/src/peer-store/persistent/index.js b/src/peer-store/persistent/index.js index 8e7c459fb8..366e9bc48f 100644 --- a/src/peer-store/persistent/index.js +++ b/src/peer-store/persistent/index.js @@ -112,7 +112,7 @@ class PersistentPeerStore extends PeerStore { const batch = this._datastore.batch() for (const peerIdStr of commitPeers) { // PeerId - const peerId = this.keyBook.data.get(peerIdStr) || PeerId.createFromB58String(peerIdStr) + const peerId = this.keyBook.data.get(peerIdStr) || PeerId.createFromCID(peerIdStr) // Address Book this._batchAddressBook(peerId, batch) diff --git a/test/peer-store/key-book.spec.js b/test/peer-store/key-book.spec.js index c5eab517a5..22b708fbf2 100644 --- a/test/peer-store/key-book.spec.js +++ b/test/peer-store/key-book.spec.js @@ -23,7 +23,7 @@ describe('keyBook', () => { kb = peerStore.keyBook }) - it('throwns invalid parameters error if invalid PeerId is provided in set', () => { + it('throws invalid parameters error if invalid PeerId is provided in set', () => { try { kb.set('invalid peerId') } catch (err) { @@ -33,7 +33,7 @@ describe('keyBook', () => { throw new Error('invalid peerId should throw error') }) - it('throwns invalid parameters error if invalid PeerId is provided in get', () => { + it('throws invalid parameters error if invalid PeerId is provided in get', () => { try { kb.get('invalid peerId') } catch (err) { diff --git a/test/peer-store/peer-store.node.js b/test/peer-store/peer-store.node.js index 30c2230eb8..c6b34eb541 100644 --- a/test/peer-store/peer-store.node.js +++ b/test/peer-store/peer-store.node.js @@ -39,6 +39,8 @@ describe('libp2p.peerStore', () => { const localPeers = libp2p.peerStore.peers expect(localPeers.size).to.equal(1) + + // TODO: needs https://github.com/NodeFactoryIo/js-libp2p-noise/issues/58 // const publicKeyInLocalPeer = localPeers.get(remoteIdStr).id.pubKey // expect(publicKeyInLocalPeer.bytes).to.equalBytes(remoteLibp2p.peerId.pubKey.bytes)