2020-10-28 17:35:56 +00:00
|
|
|
package node
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"github.com/Secured-Finance/dione/beacon"
|
|
|
|
"github.com/Secured-Finance/dione/config"
|
|
|
|
"github.com/Secured-Finance/dione/drand"
|
|
|
|
)
|
|
|
|
|
2020-11-12 14:18:30 +00:00
|
|
|
// NewBeaconQueue creates a new beacon chain schedule
|
|
|
|
func (n *Node) NewBeaconQueue() (beacon.Queue, error) {
|
|
|
|
schedule := beacon.Queue{}
|
2020-10-28 17:35:56 +00:00
|
|
|
bc, err := drand.NewDrandBeacon(config.ChainGenesis, config.TaskEpochInterval, n.PubSubRouter.Pubsub)
|
|
|
|
if err != nil {
|
|
|
|
return nil, fmt.Errorf("creating drand beacon: %w", err)
|
|
|
|
}
|
|
|
|
schedule = append(schedule, beacon.BeaconPoint{Start: 0, Beacon: bc})
|
|
|
|
|
|
|
|
return schedule, nil
|
|
|
|
}
|