mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-19 08:14:15 +00:00
9969f7e9bf
Former-commit-id: 7d85080fc0d3b82a0bcf5b60546f22d0e78cd9e3 [formerly 7b659786136a9451a7980cb447128ad4f059efd1] Former-commit-id: 9844823e588bf0d9127fb4019bd66812b6527411
42 lines
1.3 KiB
Go
42 lines
1.3 KiB
Go
// Package proposer defines all relevant functionality for a Proposer actor
|
|
// within the minimal sharding protocol.
|
|
package proposer
|
|
|
|
import (
|
|
"github.com/ethereum/go-ethereum/log"
|
|
"github.com/ethereum/go-ethereum/sharding"
|
|
"github.com/ethereum/go-ethereum/sharding/database"
|
|
"github.com/ethereum/go-ethereum/sharding/mainchain"
|
|
)
|
|
|
|
// 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 {
|
|
client mainchain.Client
|
|
shardp2p sharding.ShardP2P
|
|
txpool sharding.TXPool
|
|
shardChainDb database.ShardBackend
|
|
}
|
|
|
|
// NewProposer creates a struct instance of a proposer service.
|
|
// It will have access to a mainchain client, a shardp2p network,
|
|
// and a shard transaction pool.
|
|
func NewProposer(client mainchain.Client, shardp2p sharding.ShardP2P, txpool sharding.TXPool, shardChainDb database.ShardBackend) (*Proposer, error) {
|
|
// Initializes a directory persistent db.
|
|
return &Proposer{client, shardp2p, txpool, shardChainDb}, 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
|
|
}
|