mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-04-25 10:32:14 +00:00
chore: apply suggestions from code review
Co-authored-by: Jacob Heun <jacobheun@gmail.com>
This commit is contained in:
parent
d21a138d40
commit
9eaed58604
@ -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)
|
||||
|
@ -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) {
|
||||
|
@ -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)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user