mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-08 18:51:19 +00:00
a4a0ca98dd
Former-commit-id: ea182c0890138082396b4d06d543a9929efa73de [formerly fbb923ff61f07a4e2cd6022069d7b29fca244c02] Former-commit-id: 6b9769d4250599a6720cbdceb3e41459d7b1b5da
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)
|
|
}
|