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:
status-bors-ng[bot] 2022-09-09 03:42:10 +00:00 committed by GitHub
commit 7c462d0e3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -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

View File

@ -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> {