mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-11 00:18:06 -05:00
Refactor proposer
Former-commit-id: 2c934014a8624f84a33850a748dc41227f6a64e8 [formerly eebbc1a6350e0895f770c89efee80204cfd63fba] Former-commit-id: 74dca03e825ee2a5af2f8e4bce21c8ae0cae70ee
This commit is contained in:
@@ -2,7 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"github.com/ethereum/go-ethereum/sharding/collator"
|
||||
//"github.com/ethereum/go-ethereum/sharding/proposer"
|
||||
"github.com/ethereum/go-ethereum/sharding/proposer"
|
||||
|
||||
"github.com/ethereum/go-ethereum/cmd/utils"
|
||||
cli "gopkg.in/urfave/cli.v1"
|
||||
@@ -41,11 +41,6 @@ func collatorClient(ctx *cli.Context) error {
|
||||
}
|
||||
|
||||
func proposerClient(ctx *cli.Context) error {
|
||||
/*p := proposer.NewProposerClient(ctx)
|
||||
if err := proposer.ProposerStart(p); err != nil {
|
||||
return err
|
||||
}
|
||||
p.Wait()
|
||||
*/
|
||||
return nil
|
||||
p := proposer.NewProposer(ctx)
|
||||
return p.Start()
|
||||
}
|
||||
|
||||
@@ -1,21 +1,34 @@
|
||||
package proposer
|
||||
|
||||
import (
|
||||
"github.com/ethereum/go-ethereum/sharding/client"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/ethereum/go-ethereum/sharding/client"
|
||||
cli "gopkg.in/urfave/cli.v1"
|
||||
)
|
||||
|
||||
func NewProposerClient(ctx *cli.Context) *client.ShardingClient {
|
||||
c := client.MakeClient(ctx)
|
||||
return c
|
||||
|
||||
type Proposer interface {
|
||||
Start() error
|
||||
}
|
||||
|
||||
func ProposerStart(sclient *client.ShardingClient) error {
|
||||
type proposer struct {
|
||||
client client.Client
|
||||
}
|
||||
|
||||
func NewProposer(ctx *cli.Context) Proposer {
|
||||
return &proposer{
|
||||
client: client.NewClient(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
func (p *proposer) Start() error {
|
||||
log.Info("Starting proposer client")
|
||||
sclient.Start()
|
||||
err := p.client.Start()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer p.client.Close()
|
||||
|
||||
// TODO: Propose collations
|
||||
|
||||
return nil
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user