mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-04 00:44:27 +00:00
1c0d4e848e
Former-commit-id: 8b8b695ddc0a39bfe6a536fd7b7f40d74c4105da [formerly 829d481af0eebd1647a34006018761e3e64c5e3e] Former-commit-id: 1d607fcb8fae1327c346bdf3557ec40a8816a09b
40 lines
1.1 KiB
Go
40 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) {
|
|
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
|
|
}
|