mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-13 13:43:30 +00:00
sharding: register p2p and txpool in order
Former-commit-id: cd4ebad4a45c3f02d9fb14134bdcd3e85187241e [formerly 507ca92b4728a695d67dd416c71b77f0fa4d33e3] Former-commit-id: c1350c2143ebdfb4e17f19f7ffb77351a854db91
This commit is contained in:
parent
1057d8bf6a
commit
8685b0a201
@ -71,6 +71,15 @@ func New(ctx *cli.Context) (*ShardEthereum, error) {
|
||||
// Adds the initialized SMCClient to the ShardEthereum instance.
|
||||
shardEthereum.smcClient = smcClient
|
||||
|
||||
// TODO: Find a better way to do this???
|
||||
if err := shardEthereum.registerP2P(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err := shardEthereum.registerTXPool(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err := shardEthereum.registerActorService(actorFlag); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -140,6 +149,20 @@ func (s *ShardEthereum) Register(constructor sharding.ServiceConstructor) error
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *ShardEthereum) registerP2P() error {
|
||||
return s.Register(func(ctx *sharding.ServiceContext) (sharding.Service, error) {
|
||||
return shardp2p.NewServer()
|
||||
})
|
||||
}
|
||||
|
||||
func (s *ShardEthereum) registerTXPool() error {
|
||||
return s.Register(func(ctx *sharding.ServiceContext) (sharding.Service, error) {
|
||||
var p2p *shardp2p.Server
|
||||
ctx.Service(&p2p)
|
||||
return txpool.NewShardTXPool(p2p)
|
||||
})
|
||||
}
|
||||
|
||||
// Registers the actor according to CLI flags. Either notary/proposer/observer.
|
||||
func (s *ShardEthereum) registerActorService(actor string) error {
|
||||
return s.Register(func(ctx *sharding.ServiceContext) (sharding.Service, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user