Skip to content

Commit

Permalink
node/p2p: Increase gossipParams.Dhi to 50 for testnet bootstrap node
Browse files Browse the repository at this point in the history
  • Loading branch information
tbjump authored and tbjump committed Aug 22, 2023
1 parent a9a0912 commit e75848d
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions node/pkg/p2p/p2p.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,21 @@ func Run(

topic := fmt.Sprintf("%s/%s", networkID, "broadcast")

bootstrappers, bootstrapNode := bootstrapAddrs(logger, bootstrapPeers, h.ID())
gossipParams := pubsub.DefaultGossipSubParams()

if bootstrapNode {
logger.Info("We are a bootstrap node.")
if networkID == "/wormhole/testnet/2/1" {
gossipParams.Dhi = 50
logger.Info("We are a bootstrap node in Testnet. Setting gossipParams.Dhi.", zap.Int("gossipParams.Dhi", gossipParams.Dhi))
}
}

logger.Info("Subscribing pubsub topic", zap.String("topic", topic))
ps, err := pubsub.NewGossipSub(ctx, h,
pubsub.WithValidateQueueSize(P2P_VALIDATE_QUEUE_SIZE),
pubsub.WithGossipSubParams(gossipParams),
)
if err != nil {
panic(err)
Expand Down Expand Up @@ -308,13 +320,8 @@ func Run(
// Make sure we connect to at least 1 bootstrap node (this is particularly important in a local devnet and CI
// as peer discovery can take a long time).

bootstrappers, bootstrapNode := bootstrapAddrs(logger, bootstrapPeers, h.ID())
successes := connectToPeers(ctx, logger, h, bootstrappers)

if bootstrapNode {
logger.Info("We are a bootstrap node.")
}

if successes == 0 && !bootstrapNode { // If we're a bootstrap node it's okay to not have any peers.
// If we fail to connect to any bootstrap peer, kill the service
// returning from this function will lead to rootCtxCancel() being called in the defer() above. The service will then be restarted by Tilt/kubernetes.
Expand Down

0 comments on commit e75848d

Please sign in to comment.