mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
Massive code cleanup (#10913)
* Massive code cleanup * fix test issues * remove GetGenesis mock expectations * unused receiver * rename unused params Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
@@ -57,16 +57,16 @@ func (s *Service) processPendingBlocks(ctx context.Context) error {
|
||||
if err := s.validatePendingSlots(); err != nil {
|
||||
return errors.Wrap(err, "could not validate pending slots")
|
||||
}
|
||||
slots := s.sortedPendingSlots()
|
||||
ss := s.sortedPendingSlots()
|
||||
var parentRoots [][32]byte
|
||||
|
||||
span.AddAttributes(
|
||||
trace.Int64Attribute("numSlots", int64(len(slots))),
|
||||
trace.Int64Attribute("numSlots", int64(len(ss))),
|
||||
trace.Int64Attribute("numPeers", int64(len(pids))),
|
||||
)
|
||||
|
||||
randGen := rand.NewGenerator()
|
||||
for _, slot := range slots {
|
||||
for _, slot := range ss {
|
||||
// process the blocks during their respective slot.
|
||||
// otherwise wait for the right slot to process the block.
|
||||
if slot > s.cfg.chain.CurrentSlot() {
|
||||
@@ -257,15 +257,15 @@ func (s *Service) sortedPendingSlots() []types.Slot {
|
||||
|
||||
items := s.slotToPendingBlocks.Items()
|
||||
|
||||
slots := make([]types.Slot, 0, len(items))
|
||||
ss := make([]types.Slot, 0, len(items))
|
||||
for k := range items {
|
||||
slot := cacheKeyToSlot(k)
|
||||
slots = append(slots, slot)
|
||||
ss = append(ss, slot)
|
||||
}
|
||||
sort.Slice(slots, func(i, j int) bool {
|
||||
return slots[i] < slots[j]
|
||||
sort.Slice(ss, func(i, j int) bool {
|
||||
return ss[i] < ss[j]
|
||||
})
|
||||
return slots
|
||||
return ss
|
||||
}
|
||||
|
||||
// validatePendingSlots validates the pending blocks
|
||||
|
||||
Reference in New Issue
Block a user