refactor: remove unnecessary peermanager dependency (#1474)

This commit is contained in:
Alvaro Revuelta 2023-01-11 09:10:46 +01:00 committed by GitHub
parent 76bb7520f3
commit 53bf00de69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 14 deletions

View File

@ -382,7 +382,7 @@ proc mountRelay*(node: WakuNode,
info "mounting relay protocol"
let initRes = WakuRelay.new(
node.peerManager,
node.switch,
defaultPubsubTopics = concat(@[DefaultPubsubTopic], topics),
triggerSelf = triggerSelf
)

View File

@ -16,9 +16,9 @@ import
libp2p/protocols/pubsub/pubsub,
libp2p/protocols/pubsub/rpc/messages,
libp2p/protocols/pubsub/gossipsub,
libp2p/stream/connection
libp2p/stream/connection,
libp2p/switch
import
../node/peer_manager/peer_manager,
./waku_message
logScope:
@ -36,7 +36,6 @@ type
type
WakuRelay* = ref object of GossipSub
peerManager: PeerManager
defaultPubsubTopics*: seq[PubsubTopic] # Default configured PubSub topics
@ -77,7 +76,7 @@ method initPubSub(w: WakuRelay) {.raises: [InitializationError].} =
proc new*(T: type WakuRelay,
peerManager: PeerManager,
switch: Switch,
defaultPubsubTopics: seq[PubsubTopic] = @[],
triggerSelf: bool = true): WakuRelayResult[T] =
@ -91,7 +90,7 @@ proc new*(T: type WakuRelay,
var wr: WakuRelay
try:
wr = WakuRelay.init(
switch = peerManager.switch,
switch = switch,
msgIdProvider = msgIdProvider,
triggerSelf = triggerSelf,
sign = false,
@ -101,7 +100,6 @@ proc new*(T: type WakuRelay,
except InitializationError:
return err("initialization error: " & getCurrentExceptionMsg())
wr.peerManager = peerManager
wr.defaultPubsubTopics = defaultPubsubTopics
ok(wr)