mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 04:47:18 +00:00
Fix param naming in BestNonFinalized (#7693)
This commit is contained in:
parent
926d3b9b34
commit
3584bcba8e
@ -482,19 +482,19 @@ func (p *Status) BestFinalized(maxPeers int, ourFinalizedEpoch uint64) (uint64,
|
||||
return targetEpoch, potentialPIDs
|
||||
}
|
||||
|
||||
// BestNonFinalized returns the highest known epoch, which is higher than ours, and is shared
|
||||
// by at least minPeers.
|
||||
func (p *Status) BestNonFinalized(minPeers int, ourFinalizedEpoch uint64) (uint64, []peer.ID) {
|
||||
// BestNonFinalized returns the highest known epoch, higher than ours,
|
||||
// and is shared by at least minPeers.
|
||||
func (p *Status) BestNonFinalized(minPeers int, ourHeadEpoch uint64) (uint64, []peer.ID) {
|
||||
connected := p.Connected()
|
||||
epochVotes := make(map[uint64]uint64)
|
||||
pidEpoch := make(map[peer.ID]uint64, len(connected))
|
||||
pidHead := make(map[peer.ID]uint64, len(connected))
|
||||
potentialPIDs := make([]peer.ID, 0, len(connected))
|
||||
|
||||
ourFinalizedSlot := ourFinalizedEpoch * params.BeaconConfig().SlotsPerEpoch
|
||||
ourHeadSlot := ourHeadEpoch * params.BeaconConfig().SlotsPerEpoch
|
||||
for _, pid := range connected {
|
||||
peerChainState, err := p.ChainState(pid)
|
||||
if err == nil && peerChainState != nil && peerChainState.HeadSlot > ourFinalizedSlot {
|
||||
if err == nil && peerChainState != nil && peerChainState.HeadSlot > ourHeadSlot {
|
||||
epoch := helpers.SlotToEpoch(peerChainState.HeadSlot)
|
||||
epochVotes[epoch]++
|
||||
pidEpoch[pid] = epoch
|
||||
|
Loading…
Reference in New Issue
Block a user