mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 23:18:15 -05:00
Refactor: move functions beacon-chain/core/time -> time/slots (#9719)
* Move necessary functions beacon-chain/core/time -> time/slots * Fix fuzz * Fix build * Update slot_epoch.go
This commit is contained in:
@@ -35,7 +35,6 @@ import (
|
||||
manet "github.com/multiformats/go-multiaddr/net"
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
"github.com/prysmaticlabs/go-bitfield"
|
||||
coreTime "github.com/prysmaticlabs/prysm/beacon-chain/core/time"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/p2p/peers/peerdata"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/p2p/peers/scorers"
|
||||
"github.com/prysmaticlabs/prysm/config/features"
|
||||
@@ -44,6 +43,7 @@ import (
|
||||
pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/metadata"
|
||||
prysmTime "github.com/prysmaticlabs/prysm/time"
|
||||
"github.com/prysmaticlabs/prysm/time/slots"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -707,7 +707,7 @@ func (p *Status) BestNonFinalized(minPeers int, ourHeadEpoch types.Epoch) (types
|
||||
for _, pid := range connected {
|
||||
peerChainState, err := p.ChainState(pid)
|
||||
if err == nil && peerChainState != nil && peerChainState.HeadSlot > ourHeadSlot {
|
||||
epoch := coreTime.SlotToEpoch(peerChainState.HeadSlot)
|
||||
epoch := slots.ToEpoch(peerChainState.HeadSlot)
|
||||
epochVotes[epoch]++
|
||||
pidEpoch[pid] = epoch
|
||||
pidHead[pid] = peerChainState.HeadSlot
|
||||
@@ -876,7 +876,7 @@ func (p *Status) HighestEpoch() types.Epoch {
|
||||
highestSlot = peerData.ChainState.HeadSlot
|
||||
}
|
||||
}
|
||||
return coreTime.SlotToEpoch(highestSlot)
|
||||
return slots.ToEpoch(highestSlot)
|
||||
}
|
||||
|
||||
// ConnectedPeerLimit returns the peer limit of
|
||||
|
||||
Reference in New Issue
Block a user