mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-08 10:41:19 +00:00
8bff6099c6
Former-commit-id: 251eebf6cb46497e3afda66e0496ebd04593a741 [formerly 3399601d0fd7263f99ad2a6c0e9935e1ad0139a9] Former-commit-id: e92aa0f01cd90b73684d5f3b3d8b127ae5130b1b
43 lines
785 B
Go
43 lines
785 B
Go
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 c.client.DepositFlagSet() {
|
|
if err := joinNotaryPool(c.client); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
return subscribeBlockHeaders(c.client)
|
|
}
|