mirror of https://github.com/waku-org/nwaku.git
refactor: remove unnecessary peermanager dependency (#1474)
This commit is contained in:
parent
76bb7520f3
commit
53bf00de69
|
@ -382,7 +382,7 @@ proc mountRelay*(node: WakuNode,
|
||||||
info "mounting relay protocol"
|
info "mounting relay protocol"
|
||||||
|
|
||||||
let initRes = WakuRelay.new(
|
let initRes = WakuRelay.new(
|
||||||
node.peerManager,
|
node.switch,
|
||||||
defaultPubsubTopics = concat(@[DefaultPubsubTopic], topics),
|
defaultPubsubTopics = concat(@[DefaultPubsubTopic], topics),
|
||||||
triggerSelf = triggerSelf
|
triggerSelf = triggerSelf
|
||||||
)
|
)
|
||||||
|
|
|
@ -16,9 +16,9 @@ import
|
||||||
libp2p/protocols/pubsub/pubsub,
|
libp2p/protocols/pubsub/pubsub,
|
||||||
libp2p/protocols/pubsub/rpc/messages,
|
libp2p/protocols/pubsub/rpc/messages,
|
||||||
libp2p/protocols/pubsub/gossipsub,
|
libp2p/protocols/pubsub/gossipsub,
|
||||||
libp2p/stream/connection
|
libp2p/stream/connection,
|
||||||
|
libp2p/switch
|
||||||
import
|
import
|
||||||
../node/peer_manager/peer_manager,
|
|
||||||
./waku_message
|
./waku_message
|
||||||
|
|
||||||
logScope:
|
logScope:
|
||||||
|
@ -36,7 +36,6 @@ type
|
||||||
|
|
||||||
type
|
type
|
||||||
WakuRelay* = ref object of GossipSub
|
WakuRelay* = ref object of GossipSub
|
||||||
peerManager: PeerManager
|
|
||||||
defaultPubsubTopics*: seq[PubsubTopic] # Default configured PubSub topics
|
defaultPubsubTopics*: seq[PubsubTopic] # Default configured PubSub topics
|
||||||
|
|
||||||
|
|
||||||
|
@ -77,7 +76,7 @@ method initPubSub(w: WakuRelay) {.raises: [InitializationError].} =
|
||||||
|
|
||||||
|
|
||||||
proc new*(T: type WakuRelay,
|
proc new*(T: type WakuRelay,
|
||||||
peerManager: PeerManager,
|
switch: Switch,
|
||||||
defaultPubsubTopics: seq[PubsubTopic] = @[],
|
defaultPubsubTopics: seq[PubsubTopic] = @[],
|
||||||
triggerSelf: bool = true): WakuRelayResult[T] =
|
triggerSelf: bool = true): WakuRelayResult[T] =
|
||||||
|
|
||||||
|
@ -91,7 +90,7 @@ proc new*(T: type WakuRelay,
|
||||||
var wr: WakuRelay
|
var wr: WakuRelay
|
||||||
try:
|
try:
|
||||||
wr = WakuRelay.init(
|
wr = WakuRelay.init(
|
||||||
switch = peerManager.switch,
|
switch = switch,
|
||||||
msgIdProvider = msgIdProvider,
|
msgIdProvider = msgIdProvider,
|
||||||
triggerSelf = triggerSelf,
|
triggerSelf = triggerSelf,
|
||||||
sign = false,
|
sign = false,
|
||||||
|
@ -101,7 +100,6 @@ proc new*(T: type WakuRelay,
|
||||||
except InitializationError:
|
except InitializationError:
|
||||||
return err("initialization error: " & getCurrentExceptionMsg())
|
return err("initialization error: " & getCurrentExceptionMsg())
|
||||||
|
|
||||||
wr.peerManager = peerManager
|
|
||||||
wr.defaultPubsubTopics = defaultPubsubTopics
|
wr.defaultPubsubTopics = defaultPubsubTopics
|
||||||
|
|
||||||
ok(wr)
|
ok(wr)
|
||||||
|
|
Loading…
Reference in New Issue