mirror of https://github.com/waku-org/js-waku.git
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]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- `Error: Bootstrap requires a list of peer addresses` error when using `bootstrap: true` in `Waku.create`.
|
||||||
|
|
||||||
## [0.13.0] - 2021-09-16
|
## [0.13.0] - 2021-09-16
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
|
@ -61,7 +61,7 @@ export async function getBootstrapNodes(
|
||||||
|
|
||||||
if (typeof nodes === 'object') {
|
if (typeof nodes === 'object') {
|
||||||
nodes = Object.values(nodes);
|
nodes = Object.values(nodes);
|
||||||
getPseudoRandomSubset(nodes, wantedNumber);
|
return getPseudoRandomSubset(nodes, wantedNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw `Failed to retrieve bootstrap nodes: response format is not supported: ${JSON.stringify(
|
throw `Failed to retrieve bootstrap nodes: response format is not supported: ${JSON.stringify(
|
||||||
|
|
|
@ -31,6 +31,25 @@ describe('Waku Dial', function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Bootstrap', 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 () {
|
it('Passing an array', async function () {
|
||||||
this.timeout(10_000);
|
this.timeout(10_000);
|
||||||
|
|
||||||
|
|
|
@ -202,14 +202,14 @@ export class Waku {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bootstrap !== undefined) {
|
if (bootstrap !== undefined) {
|
||||||
|
try {
|
||||||
|
const list = await bootstrap();
|
||||||
|
|
||||||
// Note: this overrides any other peer discover
|
// Note: this overrides any other peer discover
|
||||||
libp2pOpts.modules = Object.assign(libp2pOpts.modules, {
|
libp2pOpts.modules = Object.assign(libp2pOpts.modules, {
|
||||||
peerDiscovery: [Bootstrap],
|
peerDiscovery: [Bootstrap],
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
|
||||||
const list = await bootstrap();
|
|
||||||
|
|
||||||
libp2pOpts.config.peerDiscovery = {
|
libp2pOpts.config.peerDiscovery = {
|
||||||
[Bootstrap.tag]: {
|
[Bootstrap.tag]: {
|
||||||
list,
|
list,
|
||||||
|
|
Loading…
Reference in New Issue