fix: do not ignore promise in `addPeerToAddressBook`

This commit is contained in:
fryorcraken.eth 2022-09-09 10:32:43 +10:00
parent 31873e2ee2
commit 07007eadb0
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
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]
### Changed
- `addPeerToAddressBook` is now async.
## [0.26.0] - 2022-09-08
### 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.
*/
addPeerToAddressBook(
async addPeerToAddressBook(
peerId: PeerId | string,
multiaddrs: Multiaddr[] | string[]
): void {
): Promise<void> {
let peer;
if (typeof peerId === "string") {
peer = peerIdFromString(peerId);
@ -160,7 +160,7 @@ export class WakuNode implements Waku {
return addr;
}
});
this.libp2p.peerStore.addressBook.set(peer, addresses);
await this.libp2p.peerStore.addressBook.set(peer, addresses);
}
async start(): Promise<void> {