mirror of
https://github.com/status-im/js-waku.git
synced 2025-02-23 02:18:25 +00:00
Merge pull request #298 from status-im/boostrap-true
This commit is contained in:
commit
d432f08652
@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
|
||||
- `Error: Bootstrap requires a list of peer addresses` error when using `bootstrap: true` in `Waku.create`.
|
||||
|
||||
## [0.13.0] - 2021-09-16
|
||||
|
||||
### Changed
|
||||
|
@ -61,7 +61,7 @@ export async function getBootstrapNodes(
|
||||
|
||||
if (typeof nodes === 'object') {
|
||||
nodes = Object.values(nodes);
|
||||
getPseudoRandomSubset(nodes, wantedNumber);
|
||||
return getPseudoRandomSubset(nodes, wantedNumber);
|
||||
}
|
||||
|
||||
throw `Failed to retrieve bootstrap nodes: response format is not supported: ${JSON.stringify(
|
||||
|
@ -31,6 +31,25 @@ describe('Waku Dial', function () {
|
||||
});
|
||||
|
||||
describe('Bootstrap', function () {
|
||||
it('Passing a boolean', async function () {
|
||||
// This test depends on fleets.status.im being online.
|
||||
// This dependence must be removed once DNS discovery is implemented
|
||||
this.timeout(20_000);
|
||||
|
||||
waku = await Waku.create({
|
||||
staticNoiseKey: NOISE_KEY_1,
|
||||
bootstrap: true,
|
||||
});
|
||||
|
||||
const connectedPeerID: PeerId = await new Promise((resolve) => {
|
||||
waku.libp2p.connectionManager.on('peer:connect', (connection) => {
|
||||
resolve(connection.remotePeer);
|
||||
});
|
||||
});
|
||||
|
||||
expect(connectedPeerID).to.not.be.undefined;
|
||||
});
|
||||
|
||||
it('Passing an array', async function () {
|
||||
this.timeout(10_000);
|
||||
|
||||
|
@ -202,14 +202,14 @@ export class Waku {
|
||||
}
|
||||
|
||||
if (bootstrap !== undefined) {
|
||||
try {
|
||||
const list = await bootstrap();
|
||||
|
||||
// Note: this overrides any other peer discover
|
||||
libp2pOpts.modules = Object.assign(libp2pOpts.modules, {
|
||||
peerDiscovery: [Bootstrap],
|
||||
});
|
||||
|
||||
try {
|
||||
const list = await bootstrap();
|
||||
|
||||
libp2pOpts.config.peerDiscovery = {
|
||||
[Bootstrap.tag]: {
|
||||
list,
|
||||
|
Loading…
x
Reference in New Issue
Block a user