Skip to content

Commit

Permalink
Rename loop var for better readability (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
sergekh2 authored May 24, 2024
1 parent e78f208 commit b415698
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions core/node/events/stream_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,36 +350,36 @@ func (s *streamCacheImpl) processMiniblockProposalBatch(

miniblocks := make([]contracts.SetMiniblock, 0, len(candidates))
proposals := map[StreamId]*MiniblockInfo{}
for _, s := range candidates {
for _, c := range candidates {
// Test also creates miniblocks on demand.
// Miniblock production code is going to be hardened to be able to handle multiple concurrent calls.
// But this is not the case yet, to make tests stable do not attempt to create miniblock if
// another one is already in progress.
if !s.makeMiniblockMutex.TryLock() {
if !c.makeMiniblockMutex.TryLock() {
continue
}
defer s.makeMiniblockMutex.Unlock()
defer c.makeMiniblockMutex.Unlock()

proposal, err := s.ProposeNextMiniblock(ctx, false)
proposal, err := c.ProposeNextMiniblock(ctx, false)
if err != nil {
log.Error("processMiniblockProposalBatch: Error creating new miniblock proposal", "streamId", s.streamId, "err", err)
log.Error("processMiniblockProposalBatch: Error creating new miniblock proposal", "streamId", c.streamId, "err", err)
continue
}
if proposal == nil {
log.Debug("processMiniblockProposalBatch: No miniblock to produce", "streamId", s.streamId)
log.Debug("processMiniblockProposalBatch: No miniblock to produce", "streamId", c.streamId)
continue
}
miniblocks = append(
miniblocks,
contracts.SetMiniblock{
StreamId: s.streamId,
StreamId: c.streamId,
PrevMiniBlockHash: *proposal.headerEvent.PrevMiniblockHash,
LastMiniblockHash: proposal.headerEvent.Hash,
LastMiniblockNum: uint64(proposal.Num),
IsSealed: false,
},
)
proposals[s.streamId] = proposal
proposals[c.streamId] = proposal
}

if len(miniblocks) == 0 {
Expand Down

0 comments on commit b415698

Please sign in to comment.