mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-09 11:11:20 +00:00
67c37cde39
Former-commit-id: 3782465be416107779942a03984ae0b77e5efd20 [formerly 6ef8e5ea1b51845a9510e0597681a001f602076d] Former-commit-id: 0bd84c0478896264737f96ec4d08e9587dd2172c
37 lines
1.1 KiB
Go
37 lines
1.1 KiB
Go
// Package observer launches a service attached to the sharding node
|
|
// that simply observes activity across the sharded Ethereum network.
|
|
package observer
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/ethereum/go-ethereum/ethdb"
|
|
"github.com/ethereum/go-ethereum/log"
|
|
"github.com/ethereum/go-ethereum/sharding/p2p"
|
|
)
|
|
|
|
// Observer holds functionality required to run an observer service
|
|
// in a sharded system. Must satisfy the Service interface defined in
|
|
// sharding/service.go.
|
|
type Observer struct {
|
|
p2p *p2p.Server
|
|
shardChainDb ethdb.Database
|
|
shardID int
|
|
}
|
|
|
|
// NewObserver creates a new observer instance.
|
|
func NewObserver(p2p *p2p.Server, shardChainDb ethdb.Database, shardID int) (*Observer, error) {
|
|
return &Observer{p2p, shardChainDb, shardID}, nil
|
|
}
|
|
|
|
// Start the main routine for an observer.
|
|
func (o *Observer) Start() {
|
|
log.Info(fmt.Sprintf("Starting observer service in shard %d", o.shardID))
|
|
}
|
|
|
|
// Stop the main loop for observing the shard network.
|
|
func (o *Observer) Stop() error {
|
|
log.Info(fmt.Sprintf("Starting observer service in shard %d", o.shardID))
|
|
return nil
|
|
}
|