prysm-pulse/sharding/proposer/proposer_client.go
Terence Tsao df211116c0 sharding: addHeader and checkHeader functions
Former-commit-id: cca3337844e469eec619103be79891631f2a1472 [formerly 08815fe23f67a1553dcadc039aedc2e11bbd9b4d]
Former-commit-id: 8f558a42773ed8f27295d2951719ac3cbe7b7133
2018-05-11 14:40:23 -07:00

41 lines
877 B
Go

package proposer
import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/sharding/client"
cli "gopkg.in/urfave/cli.v1"
)
// Proposer holds functionality required to run a collation proposer
// in a sharded system.
type Proposer interface {
Start() error
}
type proposer struct {
client client.Client
}
// NewProposer creates a struct instance.
func NewProposer(ctx *cli.Context) Proposer {
return &proposer{
client: client.NewClient(ctx),
}
}
// Start the main entry point for proposing collations.
func (p *proposer) Start() error {
log.Info("Starting proposer client")
err := p.client.Start()
if err != nil {
return err
}
defer p.client.Close()
// TODO: Propose collations.
// TODO: For every period, check if someone has added a header.
// TODO: If no one has added, it's our turn, send addHeader transaction.
return nil
}