prysm-pulse/sharding/collator/collator_client.go
Preston Van Loon 13789b6e63 Cleanup refactoring for sharding client interface and collator.
Former-commit-id: 9d452ada62e9afe7295d07b2e7650736e640b39a [formerly ef6fcf4365cff18f14e9bfbd43d6b9d362abfbe4]
Former-commit-id: ede05e77ef22b10fd7d12ac635d2879165416904
2018-03-31 14:25:39 -04:00

39 lines
675 B
Go

package collator
import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/sharding/client"
cli "gopkg.in/urfave/cli.v1"
)
type Collator interface {
Start() error
}
type collator struct {
client client.Client
}
// NewCollator creates a new collator instance.
func NewCollator(ctx *cli.Context) Collator {
return &collator{
client: client.NewClient(ctx),
}
}
// Start the main routine for a collator.
func (c *collator) Start() error {
log.Info("Starting collator client")
err := c.client.Start()
if err != nil {
return err
}
defer c.client.Close()
if err := joinCollatorPool(c.client); err != nil {
return err
}
return nil
}