mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 21:07:18 +00:00
288b38be8e
* Add `process_execution_payload` to `process_block` * bring in bellatrix p2p changes * lint * fix testcase to use MaxChunkSize as config to change allowed size instead of config * add left out config params * Fix TestForkSchedule_CorrectNumberOfForks * fixed Nishant's comments * gofmt * add switch case Co-authored-by: Mohamed Zahoor <zahoor@zahoor.in> Co-authored-by: Zahoor Mohamed <zahoor@prysmaticlabs.com> Co-authored-by: Nishant Das <nishdas93@gmail.com>
42 lines
1.4 KiB
Go
42 lines
1.4 KiB
Go
package p2p
|
|
|
|
import (
|
|
"github.com/prysmaticlabs/prysm/beacon-chain/p2p/encoder"
|
|
"github.com/prysmaticlabs/prysm/config/params"
|
|
"github.com/prysmaticlabs/prysm/time/slots"
|
|
)
|
|
|
|
// A background routine which listens for new and upcoming forks and
|
|
// updates the node's discovery service to reflect any new fork version
|
|
// changes.
|
|
func (s *Service) forkWatcher() {
|
|
slotTicker := slots.NewSlotTicker(s.genesisTime, params.BeaconConfig().SecondsPerSlot)
|
|
for {
|
|
select {
|
|
case currSlot := <-slotTicker.C():
|
|
currEpoch := slots.ToEpoch(currSlot)
|
|
if currEpoch == params.BeaconConfig().AltairForkEpoch ||
|
|
currEpoch == params.BeaconConfig().BellatrixForkEpoch {
|
|
// If we are in the fork epoch, we update our enr with
|
|
// the updated fork digest. These repeatedly does
|
|
// this over the epoch, which might be slightly wasteful
|
|
// but is fine nonetheless.
|
|
_, err := addForkEntry(s.dv5Listener.LocalNode(), s.genesisTime, s.genesisValidatorsRoot)
|
|
if err != nil {
|
|
log.WithError(err).Error("Could not add fork entry")
|
|
}
|
|
|
|
// from Bellatrix Epoch, the MaxGossipSize and the MaxChunkSize is changed to 10Mb.
|
|
if currEpoch == params.BeaconConfig().BellatrixForkEpoch {
|
|
encoder.SetMaxGossipSizeForBellatrix()
|
|
encoder.SetMaxChunkSizeForBellatrix()
|
|
}
|
|
}
|
|
case <-s.ctx.Done():
|
|
log.Debug("Context closed, exiting goroutine")
|
|
slotTicker.Done()
|
|
return
|
|
}
|
|
}
|
|
}
|