From 3acfbc898944062ff16646a26450557f29710004 Mon Sep 17 00:00:00 2001 From: Bryan White Date: Tue, 11 Jul 2023 16:58:31 +0200 Subject: [PATCH] chore: simplify base router config --- p2p/config/config.go | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/p2p/config/config.go b/p2p/config/config.go index d974001215..90350444b2 100644 --- a/p2p/config/config.go +++ b/p2p/config/config.go @@ -7,7 +7,6 @@ import ( "github.com/libp2p/go-libp2p/core/protocol" "go.uber.org/multierr" - "github.com/pokt-network/pocket/p2p/providers" typesP2P "github.com/pokt-network/pocket/p2p/types" "github.com/pokt-network/pocket/shared/crypto" "github.com/pokt-network/pocket/shared/modules" @@ -20,18 +19,16 @@ var ( _ typesP2P.RouterConfig = &RainTreeConfig{} ) -// baseConfig implements `RouterConfig` using the given libp2p host and current -// height and peerstore providers. Intended for internal use by other `RouterConfig` +// baseConfig implements `RouterConfig` using the given libp2p host, pokt address +// and handler function. Intended for internal use by other `RouterConfig` // implementations with common config parameters. // // NB: intentionally *not* embedding `baseConfig` to improve readability of usages // of would-be embedders (e.g. `BackgroundConfig`). type baseConfig struct { - Host host.Host - Addr crypto.Address - CurrentHeightProvider providers.CurrentHeightProvider - PeerstoreProvider providers.PeerstoreProvider - Handler func(data []byte) error + Host host.Host + Addr crypto.Address + Handler func(data []byte) error } type UnicastRouterConfig struct { @@ -62,18 +59,10 @@ func (cfg *baseConfig) IsValid() (err error) { err = multierr.Append(err, fmt.Errorf("pokt address not configured")) } - if cfg.CurrentHeightProvider == nil { - err = multierr.Append(err, fmt.Errorf("current height provider not configured")) - } - if cfg.Host == nil { err = multierr.Append(err, fmt.Errorf("host not configured")) } - if cfg.PeerstoreProvider == nil { - err = multierr.Append(err, fmt.Errorf("peerstore provider not configured")) - } - if cfg.Handler == nil { err = multierr.Append(err, fmt.Errorf("handler not configured")) }