Skip to content

Commit 6627278

Browse files
vasco-santosjacobheun
andcommittedMay 28, 2020
chore: apply suggestions from code review
Co-authored-by: Jacob Heun <jacobheun@gmail.com>
1 parent 65e8746 commit 6627278

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed
 

‎src/peer-store/persistent/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class PersistentPeerStore extends PeerStore {
112112
const batch = this._datastore.batch()
113113
for (const peerIdStr of commitPeers) {
114114
// PeerId
115-
const peerId = this.keyBook.data.get(peerIdStr) || PeerId.createFromB58String(peerIdStr)
115+
const peerId = this.keyBook.data.get(peerIdStr) || PeerId.createFromCID(peerIdStr)
116116

117117
// Address Book
118118
this._batchAddressBook(peerId, batch)

‎test/peer-store/key-book.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe('keyBook', () => {
2323
kb = peerStore.keyBook
2424
})
2525

26-
it('throwns invalid parameters error if invalid PeerId is provided in set', () => {
26+
it('throws invalid parameters error if invalid PeerId is provided in set', () => {
2727
try {
2828
kb.set('invalid peerId')
2929
} catch (err) {
@@ -33,7 +33,7 @@ describe('keyBook', () => {
3333
throw new Error('invalid peerId should throw error')
3434
})
3535

36-
it('throwns invalid parameters error if invalid PeerId is provided in get', () => {
36+
it('throws invalid parameters error if invalid PeerId is provided in get', () => {
3737
try {
3838
kb.get('invalid peerId')
3939
} catch (err) {

‎test/peer-store/peer-store.node.js

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ describe('libp2p.peerStore', () => {
3939

4040
const localPeers = libp2p.peerStore.peers
4141
expect(localPeers.size).to.equal(1)
42+
43+
// TODO: needs https://github.com/NodeFactoryIo/js-libp2p-noise/issues/58
4244
// const publicKeyInLocalPeer = localPeers.get(remoteIdStr).id.pubKey
4345
// expect(publicKeyInLocalPeer.bytes).to.equalBytes(remoteLibp2p.peerId.pubKey.bytes)
4446

0 commit comments

Comments
 (0)
Please sign in to comment.