mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-07 18:21:20 +00:00
2732187e64
Former-commit-id: add615ca3874397fc04d935b15d0913dcd2b4e18 [formerly 32f4e81a98e3084c1a9c7d277862a04f541f4cbb] Former-commit-id: 63a1630e1f679a7a341d0194c16c9cf9d11cc342
42 lines
836 B
Go
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 ¬ary{
|
|
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)
|
|
}
|