mirror of https://github.com/waku-org/js-waku.git
Merge #940
940: fix: do not ignore promise in `addPeerToAddressBook` r=fryorcraken a=fryorcraken Co-authored-by: fryorcraken.eth <git@fryorcraken.xyz>
This commit is contained in:
commit
7c462d0e3b
|
@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- `addPeerToAddressBook` is now async.
|
||||||
|
|
||||||
## [0.26.0] - 2022-09-08
|
## [0.26.0] - 2022-09-08
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -143,10 +143,10 @@ export class WakuNode implements Waku {
|
||||||
/**
|
/**
|
||||||
* Add peer to address book, it will be auto-dialed in the background.
|
* Add peer to address book, it will be auto-dialed in the background.
|
||||||
*/
|
*/
|
||||||
addPeerToAddressBook(
|
async addPeerToAddressBook(
|
||||||
peerId: PeerId | string,
|
peerId: PeerId | string,
|
||||||
multiaddrs: Multiaddr[] | string[]
|
multiaddrs: Multiaddr[] | string[]
|
||||||
): void {
|
): Promise<void> {
|
||||||
let peer;
|
let peer;
|
||||||
if (typeof peerId === "string") {
|
if (typeof peerId === "string") {
|
||||||
peer = peerIdFromString(peerId);
|
peer = peerIdFromString(peerId);
|
||||||
|
@ -160,7 +160,7 @@ export class WakuNode implements Waku {
|
||||||
return addr;
|
return addr;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.libp2p.peerStore.addressBook.set(peer, addresses);
|
await this.libp2p.peerStore.addressBook.set(peer, addresses);
|
||||||
}
|
}
|
||||||
|
|
||||||
async start(): Promise<void> {
|
async start(): Promise<void> {
|
||||||
|
|
Loading…
Reference in New Issue