2018-04-01 19:46:02 +00:00
|
|
|
// Package proposer holds all of the functionality to run as a collation proposer in a sharded
|
|
|
|
// system.
|
2018-03-29 22:55:52 +00:00
|
|
|
package proposer
|
2018-03-31 04:07:42 +00:00
|
|
|
|
|
|
|
import (
|
2018-03-31 06:13:51 +00:00
|
|
|
"github.com/ethereum/go-ethereum/log"
|
2018-03-31 21:04:22 +00:00
|
|
|
"github.com/ethereum/go-ethereum/sharding/client"
|
2018-03-31 04:07:42 +00:00
|
|
|
cli "gopkg.in/urfave/cli.v1"
|
|
|
|
)
|
|
|
|
|
2018-03-31 21:04:22 +00:00
|
|
|
type Proposer interface {
|
|
|
|
Start() error
|
|
|
|
}
|
2018-03-31 04:07:42 +00:00
|
|
|
|
2018-03-31 21:04:22 +00:00
|
|
|
type proposer struct {
|
|
|
|
client client.Client
|
2018-03-31 04:07:42 +00:00
|
|
|
}
|
|
|
|
|
2018-03-31 21:04:22 +00:00
|
|
|
func NewProposer(ctx *cli.Context) Proposer {
|
|
|
|
return &proposer{
|
|
|
|
client: client.NewClient(ctx),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *proposer) Start() error {
|
2018-03-31 06:13:51 +00:00
|
|
|
log.Info("Starting proposer client")
|
2018-03-31 21:04:22 +00:00
|
|
|
err := p.client.Start()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
defer p.client.Close()
|
2018-03-31 04:07:42 +00:00
|
|
|
|
2018-03-31 21:04:22 +00:00
|
|
|
// TODO: Propose collations
|
2018-03-31 04:07:42 +00:00
|
|
|
|
2018-03-31 21:04:22 +00:00
|
|
|
return nil
|
2018-03-31 04:07:42 +00:00
|
|
|
}
|