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
|
2020-11-13 17:50:06 +00:00
|
|
|
func (n *Node) NewBeaconQueue() (beacon.BeaconNetworks, error) {
|
|
|
|
schedule := beacon.BeaconNetworks{}
|
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)
|
|
|
|
}
|
2020-11-13 17:50:06 +00:00
|
|
|
schedule = append(schedule, beacon.BeaconNetwork{Start: 0, Beacon: bc})
|
2020-10-28 17:35:56 +00:00
|
|
|
|
|
|
|
return schedule, nil
|
|
|
|
}
|