mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-09 11:11:20 +00:00
404a1ddad0
Former-commit-id: 05b8804e0ba81e1fe22f7d930dc16f9e84e1c44c [formerly 52dd670a71f1abdfeb5dfd42c25b9f3ba9e64224] Former-commit-id: 78bd95882d71a1cd28f442dac17fe8c1bbc34ccb
42 lines
1.0 KiB
Go
42 lines
1.0 KiB
Go
package notary
|
|
|
|
import (
|
|
"github.com/ethereum/go-ethereum/log"
|
|
"github.com/ethereum/go-ethereum/sharding/node"
|
|
cli "gopkg.in/urfave/cli.v1"
|
|
)
|
|
|
|
// Notary holds functionality required to run a collation notary
|
|
// in a sharded system. Must satisfy the Service interface defined in
|
|
// sharding/service.go.
|
|
type Notary struct {
|
|
node node.Node
|
|
}
|
|
|
|
// NewNotary creates a new notary instance.
|
|
func NewNotary(ctx *cli.Context, node node.Node) (*Notary, error) {
|
|
return &Notary{node}, nil
|
|
}
|
|
|
|
// Start the main routine for a notary.
|
|
func (n *Notary) Start() error {
|
|
log.Info("Starting notary service")
|
|
|
|
// TODO: handle this better through goroutines. Right now, these methods
|
|
// have their own nested channels and goroutines within them. We need
|
|
// to make this as flat as possible at the Notary layer.
|
|
if n.node.DepositFlagSet() {
|
|
if err := joinNotaryPool(n.node); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
return subscribeBlockHeaders(n.node)
|
|
}
|
|
|
|
// Stop the main loop for notarizing collations.
|
|
func (n *Notary) Stop() error {
|
|
log.Info("Stopping notary service")
|
|
return nil
|
|
}
|