Skip to content

Commit

Permalink
Move magic numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
mvandeberg committed Jul 18, 2022
1 parent 989920e commit ec098c3
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions internal/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ type KoinosP2PNode struct {
}

const (
transactionCacheDuration = time.Minute * 10
transactionCacheDuration = 10 * time.Minute
pubsubTimeCacheDuration = time.Minute
gossipHeartbeatInterval = 500 * time.Millisecond
gossipIWantFollowupTime = time.Second
)

// NewKoinosP2PNode creates a libp2p node object listening on the given multiaddress
Expand Down Expand Up @@ -128,10 +131,10 @@ func NewKoinosP2PNode(ctx context.Context, listenAddr string, localRPC rpc.Local
log.Info("Starting P2P node without broadcast listeners")
}

pubsub.TimeCacheDuration = 60 * time.Second
pubsub.TimeCacheDuration = pubsubTimeCacheDuration
gossipOpts := pubsub.DefaultGossipSubParams()
gossipOpts.HeartbeatInterval = 500 * time.Millisecond
gossipOpts.IWantFollowupTime = time.Second
gossipOpts.HeartbeatInterval = gossipHeartbeatInterval
gossipOpts.IWantFollowupTime = gossipIWantFollowupTime
ps, err := pubsub.NewGossipSub(
ctx, node.Host,
pubsub.WithMessageIdFn(generateMessageID),
Expand Down

0 comments on commit ec098c3

Please sign in to comment.