mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-19 16:20:53 +00:00
df211116c0
Former-commit-id: cca3337844e469eec619103be79891631f2a1472 [formerly 08815fe23f67a1553dcadc039aedc2e11bbd9b4d] Former-commit-id: 8f558a42773ed8f27295d2951719ac3cbe7b7133
41 lines
877 B
Go
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
|
|
}
|