docs: peerstore configuration datastore fixed

This commit is contained in:
Vít Habada 2021-12-22 14:15:18 +01:00 committed by GitHub
parent a0516ebc85
commit 70a4bb9451
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -675,15 +675,15 @@ const { NOISE } = require('libp2p-noise')
const LevelDatastore = require('datastore-level')
const datastore = new LevelDatastore('path/to/store')
const dsInstant = await datastore.open()
await datastore.open() // level database must be ready before node boot
const node = await Libp2p.create({
datastore, // pass the opened datastore
modules: {
transport: [TCP],
streamMuxer: [MPLEX],
connEncryption: [NOISE]
},
datastore: dsInstant,
peerStore: {
persistence: true,
threshold: 5