improve DrandConfig dependency injection
This commit is contained in:
@@ -108,9 +108,13 @@ func RetrievalResolver(l *discovery.Local) retrievalmarket.PeerResolver {
|
||||
type RandomBeaconParams struct {
|
||||
fx.In
|
||||
|
||||
DrandConfig *drand.DrandConfig `optional:"true"`
|
||||
PubSub *pubsub.PubSub `optional:"true"`
|
||||
PubSub *pubsub.PubSub `optional:"true"`
|
||||
Cs *store.ChainStore
|
||||
DrandConfig dtypes.DrandConfig
|
||||
}
|
||||
|
||||
func BuiltinDrandConfig() dtypes.DrandConfig {
|
||||
return build.DrandConfig
|
||||
}
|
||||
|
||||
func RandomBeacon(p RandomBeaconParams, _ dtypes.AfterGenesisSet) (beacon.RandomBeacon, error) {
|
||||
@@ -120,5 +124,9 @@ func RandomBeacon(p RandomBeaconParams, _ dtypes.AfterGenesisSet) (beacon.Random
|
||||
}
|
||||
|
||||
//return beacon.NewMockBeacon(build.BlockDelay * time.Second)
|
||||
return drand.NewDrandBeacon(gen.Timestamp, build.BlockDelay, p.PubSub, p.DrandConfig)
|
||||
config := drand.DrandConfig{
|
||||
Servers: p.DrandConfig.Servers,
|
||||
ChainInfoJSON: p.DrandConfig.ChainInfoJSON,
|
||||
}
|
||||
return drand.NewDrandBeacon(gen.Timestamp, build.BlockDelay, p.PubSub, config)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user