Explicity Watch for randomness
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
This commit is contained in:
parent
002d021eb7
commit
30d82ba962
@ -76,13 +76,16 @@ func NewDrandBeacon(genesisTs, interval uint64, ps *pubsub.PubSub) (*DrandBeacon
|
|||||||
if genesisTs == 0 {
|
if genesisTs == 0 {
|
||||||
panic("what are you doing this cant be zero")
|
panic("what are you doing this cant be zero")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dlogger := dlog.NewKitLoggerFrom(kzap.NewZapSugarLogger(
|
||||||
|
log.SugaredLogger.Desugar(), zapcore.InfoLevel))
|
||||||
opts := []dclient.Option{
|
opts := []dclient.Option{
|
||||||
dclient.WithChainInfo(drandChain),
|
dclient.WithChainInfo(drandChain),
|
||||||
dclient.WithHTTPEndpoints(drandServers),
|
dclient.WithHTTPEndpoints(drandServers),
|
||||||
dclient.WithCacheSize(1024),
|
dclient.WithCacheSize(1024),
|
||||||
dclient.WithLogger(dlog.NewKitLoggerFrom(kzap.NewZapSugarLogger(
|
dclient.WithLogger(dlogger),
|
||||||
log.SugaredLogger.Desugar(), zapcore.InfoLevel))),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ps != nil {
|
if ps != nil {
|
||||||
opts = append(opts, gclient.WithPubsub(ps))
|
opts = append(opts, gclient.WithPubsub(ps))
|
||||||
} else {
|
} else {
|
||||||
@ -94,6 +97,14 @@ func NewDrandBeacon(genesisTs, interval uint64, ps *pubsub.PubSub) (*DrandBeacon
|
|||||||
return nil, xerrors.Errorf("creating drand client")
|
return nil, xerrors.Errorf("creating drand client")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
// Explicitly Watch until that is fixed in drand
|
||||||
|
ch := client.Watch(context.Background())
|
||||||
|
for range ch {
|
||||||
|
}
|
||||||
|
log.Error("dranch Watch bork")
|
||||||
|
}()
|
||||||
|
|
||||||
db := &DrandBeacon{
|
db := &DrandBeacon{
|
||||||
client: client,
|
client: client,
|
||||||
localCache: make(map[uint64]types.BeaconEntry),
|
localCache: make(map[uint64]types.BeaconEntry),
|
||||||
|
Loading…
Reference in New Issue
Block a user