Álex Cabeza Romero 49dd6c1989
test(peer-and-connection-management): Implement tests (#2566)
* Implement peer and connection management tests.
* Fix multiple peers added on initialisation.
* Remove clusterId parameter from newTestWakuNode.
2024-05-13 17:25:44 +02:00

13 lines
452 B
Nim

import std/options, stew/results, libp2p/peerstore
import
../../../../waku/node/peer_manager/[waku_peer_store, peer_store/waku_peer_storage],
../../../waku_archive/archive_utils
proc newTestWakuPeerStorage*(path: Option[string] = string.none()): WakuPeerStorage =
let db = newSqliteDatabase(path)
WakuPeerStorage.new(db).value()
proc peerExists*(peerStore: PeerStore, peerId: PeerId): bool =
return peerStore[AddressBook].contains(peerId)