Skip to content

Commit

Permalink
Node: p2p.Run interface change (#3996)
Browse files Browse the repository at this point in the history
* Node: p2p.Run interface change

* Guardian should be able to set disableHeartbeatVerify
  • Loading branch information
bruce-riley authored Jul 1, 2024
1 parent fdbfc0b commit d146f82
Show file tree
Hide file tree
Showing 6 changed files with 564 additions and 165 deletions.
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
54 changes: 30 additions & 24 deletions node/pkg/node/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,33 +55,39 @@ 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,
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,
disableHeartbeatVerify,
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

0 comments on commit d146f82

Please sign in to comment.