mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-06 01:32:18 +00:00
13789b6e63
Former-commit-id: 9d452ada62e9afe7295d07b2e7650736e640b39a [formerly ef6fcf4365cff18f14e9bfbd43d6b9d362abfbe4] Former-commit-id: ede05e77ef22b10fd7d12ac635d2879165416904
39 lines
675 B
Go
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
|
|
}
|