Fix DI of PubSub in markets by binding dependencies it needs

Bind drand and bootstrap peers config so that `PubSub` instantiated by
`ConfigCommon` has all the dependencies it needs when `PubSub` instance
is needed in markets. In ths case, the instance is needed by the index
provider engine to announce new indexing advertisements.
This commit is contained in:
Masih H. Derkani 2022-04-06 20:04:39 +01:00 committed by Jennifer Wang
parent e37c54f38e
commit 0a2429b467

View File

@ -75,6 +75,11 @@ func ConfigStorageMiner(c interface{}) Option {
enableLibp2pNode := cfg.Subsystems.EnableMarkets // we enable libp2p nodes if the storage market subsystem is enabled, otherwise we don't enableLibp2pNode := cfg.Subsystems.EnableMarkets // we enable libp2p nodes if the storage market subsystem is enabled, otherwise we don't
return Options( return Options(
// Needed to instantiate pubsub used by index provider via ConfigCommon
Override(new(dtypes.DrandSchedule), modules.BuiltinDrandConfig),
Override(new(dtypes.BootstrapPeers), modules.BuiltinBootstrap),
Override(new(dtypes.DrandBootstrap), modules.DrandBootstrap),
ConfigCommon(&cfg.Common, enableLibp2pNode), ConfigCommon(&cfg.Common, enableLibp2pNode),
Override(CheckFDLimit, modules.CheckFdLimit(build.MinerFDLimit)), // recommend at least 100k FD limit to miners Override(CheckFDLimit, modules.CheckFdLimit(build.MinerFDLimit)), // recommend at least 100k FD limit to miners