prysm-pulse/cmd/prysmctl/p2p/mock_chain.go
Raul Jordan 100ca0ebaf
Prysmctl Command to Request Beacon Nodes for Block Ranges Over P2P (#11035)
* first

* attempt p2p connect send tool

* attempt

* stream registration

* trying to register

* attempt

* workinnnn

* begin

* p2p prysmctl tool

* ignore

* fix

* delete deprecated

* p2p smaller iface surface area

* further p2p refactor

* gaz

* better logging

* process

* all functionality

* fix up

* rhandle

* v2 req

* cmd

* send sub

* v1 handle

* show head slot

* cmd

* cmd lib

* gazelle fix

* bazel

* gaz

* work on the handshake items

* prevent dial to self

* add config awareness

* gaz

* inferring host addrs from p2p

* initialize data mappings

* add own mock

* fix up logic

* gaz

* add img

* gaz

* add images

* builds

* builds

* nishant feedback:

Co-authored-by: Nishant Das <nishdas93@gmail.com>
2022-08-17 06:38:57 +00:00

37 lines
779 B
Go

package p2p
import (
"time"
"github.com/prysmaticlabs/prysm/v3/beacon-chain/forkchoice"
types "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives"
ethpb "github.com/prysmaticlabs/prysm/v3/proto/prysm/v1alpha1"
"github.com/prysmaticlabs/prysm/v3/time/slots"
)
type mockChain struct {
currentFork *ethpb.Fork
genesisValsRoot [32]byte
genesisTime time.Time
}
func (m *mockChain) ForkChoicer() forkchoice.ForkChoicer {
return nil
}
func (m *mockChain) CurrentFork() *ethpb.Fork {
return m.currentFork
}
func (m *mockChain) GenesisValidatorsRoot() [32]byte {
return m.genesisValsRoot
}
func (m *mockChain) GenesisTime() time.Time {
return m.genesisTime
}
func (m *mockChain) CurrentSlot() types.Slot {
return slots.SinceGenesis(m.genesisTime)
}