Skip to content

Commit

Permalink
fixup! fix(drand): add null HistoricalBeaconClient for old beacons
Browse files Browse the repository at this point in the history
  • Loading branch information
rvagg committed Jan 20, 2025
1 parent d94a9c9 commit e68c3e7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions chain/beacon/drand/drand.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ func NewDrandBeacon(genesisTs, interval uint64, ps *pubsub.PubSub, config dtypes
} else {
log.Info("drand beacon without pubsub")
if len(clients) == 0 {
// This hack is necessary to convince a drand beacon to start without any clients. For
// historical becaons we need them to be able to verify old entries but we don't need to fetch
// new ones. With pubsub enabled, it acts as a client so drand is happy, but if we don't have
// pubsub then drand will complain about old beacons withotu clients. So we make one that
// it'll think is a valid client and that it won't speed test (hence the need to mark it as
// as "watcher").
historicalClient := &historicalBeaconClient{}
clients = append(clients, historicalClient)
opts = append(opts, dclient.WithWatcher(func(chainInfo *dchain.Info, cache dclient.Cache) (dclient.Watcher, error) {
Expand Down

0 comments on commit e68c3e7

Please sign in to comment.