mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-04 00:44:27 +00:00
c654446290
Former-commit-id: df0167b1675268a36b2293c8951ea282ee383c78 [formerly 6410dee77b426976e5d685f854f11e6837985c3c] Former-commit-id: b29cc11669b443fb90dc27f99f7f8e1680e1debb
40 lines
1.2 KiB
Go
40 lines
1.2 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/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
|
|
}
|
|
|
|
// 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, shardID int) (*Proposer, error) {
|
|
// Initializes a directory persistent db.
|
|
return &Proposer{client, shardp2p, txpool}, 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
|
|
}
|