mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-06-26 07:21:36 +00:00
chore: update to new multiformats (#948)
BREAKING CHANGE: uses the CID class from the new multiformats module Co-authored-by: Vasco Santos <vasco.santos@moxy.studio>
This commit is contained in:
.github/workflows
examples
package.jsonsrc
circuit
content-routing
peer-store
record
peer-record
test
content-routing
insecure
keychain
record
relay
ts-use
@ -7,6 +7,7 @@ const log = Object.assign(debug('libp2p:persistent-peer-store'), {
|
||||
const { Key } = require('interface-datastore')
|
||||
const { Multiaddr } = require('multiaddr')
|
||||
const PeerId = require('peer-id')
|
||||
const { base32 } = require('multiformats/bases/base32')
|
||||
|
||||
const PeerStore = require('..')
|
||||
|
||||
@ -195,7 +196,7 @@ class PersistentPeerStore extends PeerStore {
|
||||
const batch = this._datastore.batch()
|
||||
for (const peerIdStr of commitPeers) {
|
||||
// PeerId
|
||||
const peerId = this.keyBook.data.get(peerIdStr) || PeerId.createFromCID(peerIdStr)
|
||||
const peerId = this.keyBook.data.get(peerIdStr) || PeerId.createFromB58String(peerIdStr)
|
||||
|
||||
// Address Book
|
||||
this._batchAddressBook(peerId, batch)
|
||||
@ -346,7 +347,7 @@ class PersistentPeerStore extends PeerStore {
|
||||
async _processDatastoreEntry ({ key, value }) {
|
||||
try {
|
||||
const keyParts = key.toString().split('/')
|
||||
const peerId = PeerId.createFromCID(keyParts[3])
|
||||
const peerId = PeerId.createFromBytes(base32.decode(keyParts[3]))
|
||||
|
||||
let decoded
|
||||
switch (keyParts[2]) {
|
||||
|
Reference in New Issue
Block a user