prysm-pulse/sharding/collator/collator_client.go
Terence Tsao 791576b204 sharding: \collator\notary\ on all files
Former-commit-id: 859723690bc327d7df9ffdd8f7ae247c05e1e1bf [formerly e2603e530217645b3f1fa180613ba27dca74e2f3]
Former-commit-id: c812bd611996a0a8a344064199163aa709ee3f24
2018-04-26 11:10:31 -07:00

42 lines
836 B
Go

// Package notary holds all of the functionality to run as a notary in a sharded system.
package notary
import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/sharding/client"
cli "gopkg.in/urfave/cli.v1"
)
// Notary runnable client.
type Notary interface {
// Start the main routine for a notary.
Start() error
}
type notary struct {
client client.Client
}
// NewNotary creates a new notary instance.
func NewNotary(ctx *cli.Context) Notary {
return &notary{
client: client.NewClient(ctx),
}
}
// Start the main routine for a notary.
func (c *notary) Start() error {
log.Info("Starting notary client")
err := c.client.Start()
if err != nil {
return err
}
defer c.client.Close()
if err := joinNotaryPool(c.client); err != nil {
return err
}
return subscribeBlockHeaders(c.client)
}