Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node: p2p.Run interface change #3996

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 13 additions & 30 deletions node/cmd/spy/spy.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,6 @@ func runSpy(cmd *cobra.Command, args []string) {
rootCtx, rootCtxCancel = context.WithCancel(context.Background())
defer rootCtxCancel()

// Outbound gossip message queue
sendC := make(chan []byte)

// Inbound signed VAAs
signedInC := make(chan *gossipv1.SignedVAAWithQuorum, 1024)

Expand Down Expand Up @@ -391,35 +388,21 @@ func runSpy(cmd *cobra.Command, args []string) {
supervisor.New(rootCtx, logger, func(ctx context.Context) error {
components := p2p.DefaultComponents()
components.Port = *p2pPort
params, err := p2p.NewRunParams(
*p2pBootstrap,
*p2pNetworkID,
priv,
gst,
rootCtxCancel,
p2p.WithSignedVAAListener(signedInC),
)
if err != nil {
return err
}

if err := supervisor.Run(ctx,
"p2p",
p2p.Run(nil, // Ignore incoming observations.
nil, // Ignore observation requests.
nil,
sendC,
signedInC,
priv,
nil,
gst,
*p2pNetworkID,
*p2pBootstrap,
"",
false,
rootCtxCancel,
nil,
nil,
nil,
nil,
components,
nil, // ibc feature string
false, // gateway relayer enabled
false, // ccqEnabled
nil, // query requests
nil, // query responses
"", // query bootstrap peers
0, // query port
"", // query allow list
)); err != nil {
p2p.Run(params)); err != nil {
return err
}

Expand Down
53 changes: 29 additions & 24 deletions node/pkg/node/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,33 +55,38 @@ func GuardianOptionP2P(p2pKey libp2p_crypto.PrivKey, networkId, bootstrapPeers,
// Add the gossip advertisement address
components.GossipAdvertiseAddress = gossipAdvertiseAddress

g.runnables["p2p"] = p2p.Run(
g.obsvC,
g.obsvReqC.writeC,
g.obsvReqSendC.readC,
g.gossipSendC,
g.signedInC.writeC,
params, err := p2p.NewRunParams(
bootstrapPeers,
networkId,
p2pKey,
g.gk,
g.gst,
networkId,
bootstrapPeers,
nodeName,
disableHeartbeatVerify,
bruce-riley marked this conversation as resolved.
Show resolved Hide resolved
g.rootCtxCancel,
g.acct,
g.gov,
nil,
nil,
components,
ibcFeaturesFunc,
(g.gatewayRelayer != nil),
(g.queryHandler != nil),
g.signedQueryReqC.writeC,
g.queryResponsePublicationC.readC,
ccqBootstrapPeers,
ccqPort,
ccqAllowedPeers,
p2p.WithGuardianOptions(
nodeName,
g.gk,
g.obsvC,
g.signedInC.writeC,
g.obsvReqC.writeC,
g.gossipSendC,
g.obsvReqSendC.readC,
g.acct,
g.gov,
components,
ibcFeaturesFunc,
(g.gatewayRelayer != nil), // gatewayRelayerEnabled,
(g.queryHandler != nil), // ccqEnabled,
g.signedQueryReqC.writeC,
g.queryResponsePublicationC.readC,
ccqBootstrapPeers,
ccqPort,
ccqAllowedPeers),
)
if err != nil {
return err
}

g.runnables["p2p"] = p2p.Run(
params,
)

return nil
Expand Down
Loading
Loading