mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-07 18:21:20 +00:00
701a33caec
Former-commit-id: 74b60e1bdacfa4889a4b7a36e22698e7bc8a6084 [formerly 6f5d01b919d58ebffa7d5c1d197d2236c2f906f7] Former-commit-id: 3ad090ec4170cc2bc901caae17f1eb4895af2c42
41 lines
743 B
Go
41 lines
743 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 err := joinNotaryPool(c.client); err != nil {
|
|
return err
|
|
}
|
|
|
|
return subscribeBlockHeaders(c.client)
|
|
}
|