Skip to content

Commit

Permalink
fix(block): Only register nodeHealthStatusHandler for sequencer (#683)
Browse files Browse the repository at this point in the history
  • Loading branch information
zale144 authored Apr 15, 2024
1 parent b766728 commit da2ff94
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
13 changes: 7 additions & 6 deletions block/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import (
"time"

"code.cloudfoundry.org/go-diodes"

"github.com/dymensionxyz/dymint/node/events"
"github.com/dymensionxyz/dymint/p2p"
"github.com/dymensionxyz/dymint/utils"
"github.com/libp2p/go-libp2p/core/crypto"
tmcrypto "github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/libs/pubsub"
tmtypes "github.com/tendermint/tendermint/types"

"github.com/dymensionxyz/dymint/node/events"
"github.com/dymensionxyz/dymint/p2p"
"github.com/dymensionxyz/dymint/utils"

"github.com/tendermint/tendermint/proxy"

"github.com/dymensionxyz/dymint/config"
Expand Down Expand Up @@ -211,8 +211,9 @@ func getAddress(key crypto.PrivKey) ([]byte, error) {

// EventListener registers events to callbacks.
func (m *Manager) EventListener(ctx context.Context, isAggregator bool) {
go utils.SubscribeAndHandleEvents(ctx, m.pubsub, "nodeHealthStatusHandler", events.EventQueryHealthStatus, m.healthStatusEventCallback, m.logger)
if !isAggregator {
if isAggregator {
go utils.SubscribeAndHandleEvents(ctx, m.pubsub, "nodeHealthStatusHandler", events.EventQueryHealthStatus, m.healthStatusEventCallback, m.logger)
} else {
go utils.SubscribeAndHandleEvents(ctx, m.pubsub, "ApplyBlockLoop", p2p.EventQueryNewNewGossipedBlock, m.applyBlockCallback, m.logger, 100)
}
}
Expand Down
4 changes: 2 additions & 2 deletions rpc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func (s *Server) startRPC() error {
// Start HTTP server
go func() {
err := s.serve(listener, handler)
if err != http.ErrServerClosed {
if !errors.Is(err, http.ErrServerClosed) {
s.Logger.Error("while serving HTTP", "error", err)
}
}()
Expand All @@ -176,7 +176,7 @@ func (s *Server) startRPC() error {

func (s *Server) serve(listener net.Listener, handler http.Handler) error {
s.Logger.Info("serving HTTP", "listen address", listener.Addr())
s.server = http.Server{Handler: handler} //#nosec
s.server = http.Server{Handler: handler} // #nosec
if s.config.TLSCertFile != "" && s.config.TLSKeyFile != "" {
return s.server.ServeTLS(listener, s.config.CertFile(), s.config.KeyFile())
}
Expand Down

0 comments on commit da2ff94

Please sign in to comment.