From e11a55ac5d2c5605a3c7404a901c4e4fa7e09cdb Mon Sep 17 00:00:00 2001 From: Bryan White Date: Tue, 11 Jul 2023 16:31:08 +0200 Subject: [PATCH] chore: simplify base router config --- p2p/config/config.go | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/p2p/config/config.go b/p2p/config/config.go index f57187b1af..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,20 +59,10 @@ func (cfg *baseConfig) IsValid() (err error) { err = multierr.Append(err, fmt.Errorf("pokt address not configured")) } - // TODO_THIS_COMMIT: ... - //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")) } - // TODO_THIS_COMMIT: ... - //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")) }