prysm-pulse/sharding/proposer/service.go
Raul Jordan 84c8c58c3d sharding: revert master changes - travis was broken
Former-commit-id: 726c06eb4248536e23b143f8e0af51cc91a8f19f [formerly 305291115def673a9b862d4701da1f1d6b4439d4]
Former-commit-id: 643294b138f2ff848b32319f8e60fad93e81095b
2018-05-25 20:16:29 -06:00

41 lines
1.1 KiB
Go

package proposer
import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/sharding/database"
"github.com/ethereum/go-ethereum/sharding/node"
)
// Proposer holds functionality required to run a collation proposer
// in a sharded system. Must satisfy the Service interface defined in
// sharding/service.go.
type Proposer struct {
node node.Node
shardDB database.ShardBackend
}
// NewProposer creates a struct instance. It is initialized and
// registered as a service upon start of a sharding node.
// Has access to the public methods of this node.
func NewProposer(node node.Node) (*Proposer, error) {
// Initializes a shardchaindata directory persistent db.
shardDB, err := database.NewShardDB(node.DataDirFlag(), "shardchaindata")
if err != nil {
return nil, err
}
return &Proposer{node, shardDB}, nil
}
// Start the main loop for proposing collations.
func (p *Proposer) Start() error {
log.Info("Starting proposer service")
// TODO: Propose collations.
return nil
}
// Stop the main loop for proposing collations.
func (p *Proposer) Stop() error {
log.Info("Stopping proposer service")
return nil
}