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

View File

@ -675,15 +675,15 @@ const { NOISE } = require('libp2p-noise')
const LevelDatastore = require('datastore-level') const LevelDatastore = require('datastore-level')
const datastore = new LevelDatastore('path/to/store') 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({ const node = await Libp2p.create({
datastore, // pass the opened datastore
modules: { modules: {
transport: [TCP], transport: [TCP],
streamMuxer: [MPLEX], streamMuxer: [MPLEX],
connEncryption: [NOISE] connEncryption: [NOISE]
}, },
datastore: dsInstant,
peerStore: { peerStore: {
persistence: true, persistence: true,
threshold: 5 threshold: 5