Skip to content

Commit

Permalink
fix: bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanchriswhite committed Jun 8, 2023
1 parent b745c50 commit b802e1e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 7 additions & 2 deletions p2p/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,19 @@ func (m *p2pModule) setupDependencies() error {

// setupPeerstoreProvider attempts to retrieve the peerstore provider from the
// bus, if one is registered, otherwise returns a new `persistencePeerstoreProvider`.
func (m *p2pModule) setupPeerstoreProvider() (err error) {
func (m *p2pModule) setupPeerstoreProvider() error {
m.logger.Debug().Msg("setupPeerstoreProvider")

// TECHDEBT(#810): simplify once submodules are more convenient to retrieve.
pstoreProviderModule, err := m.GetBus().GetModulesRegistry().GetModule(peerstore_provider.ModuleName)
if err != nil {
m.logger.Debug().Msg("creating new persistence peerstore...")
m.pstoreProvider, err = persPSP.NewPersistencePeerstoreProvider(m.GetBus())
pstoreProvider, err := persPSP.NewPersistencePeerstoreProvider(m.GetBus())
if err != nil {
return err
}

m.pstoreProvider = pstoreProvider
return nil
}

Expand Down
6 changes: 4 additions & 2 deletions p2p/providers/peerstore_provider/persistence/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ import (
"github.com/pokt-network/pocket/shared/modules/base_modules"
)

var _ peerstore_provider.PeerstoreProvider = &persistencePeerstoreProvider{}
var (
_ peerstore_provider.PeerstoreProvider = &persistencePeerstoreProvider{}
_ persistencePStoreProviderFactory = &persistencePeerstoreProvider{}
)

type persistencePStoreProviderOption func(*persistencePeerstoreProvider)
type persistencePStoreProviderFactory = modules.FactoryWithOptions[peerstore_provider.PeerstoreProvider, persistencePStoreProviderOption]
type persistencePeerstoreProvider struct {
base_modules.IntegratableModule
persistencePStoreProviderFactory
}

func NewPersistencePeerstoreProvider(bus modules.Bus, options ...persistencePStoreProviderOption) (peerstore_provider.PeerstoreProvider, error) {
Expand Down

0 comments on commit b802e1e

Please sign in to comment.