prysm-pulse/sharding/notary/actor.go
Raul Jordan 28d9f553ae sharding: fixed tests to pass with refactor
Former-commit-id: a0cee6739e623199f57752272da9b2372be856c9 [formerly c016afddd2cc56db8b47e161c444d47fe7bfa2f2]
Former-commit-id: f8d790ea8040c67641f6241a7c9886e8983352bf
2018-06-04 15:31:42 -04:00

41 lines
1.0 KiB
Go

package notary
import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/sharding"
)
// 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 sharding.Node
}
// NewNotary creates a new notary instance.
func NewNotary(node sharding.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.SMCClient().DepositFlag() {
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
}