From 88fa22fd1a11905d697d8acd6733a9cdc71b5024 Mon Sep 17 00:00:00 2001 From: Faye Amacker <33205765+fxamacker@users.noreply.github.com> Date: Tue, 14 May 2024 07:20:30 -0500 Subject: [PATCH] Improve code readability by adding comments, etc. --- storage.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/storage.go b/storage.go index 909beb9..8c40161 100644 --- a/storage.go +++ b/storage.go @@ -1037,17 +1037,19 @@ func (s *PersistentSlabStorage) NondeterministicFastCommit(numWorkers int) error modifiedSlabCount := 0 // Deleted slabs need to be removed from underlying storage. deletedSlabCount := 0 - for k, v := range s.deltas { + for id, slab := range s.deltas { // Ignore slabs not owned by accounts - if k.address == AddressUndefined { + if id.address == AddressUndefined { continue } - if v == nil { + if slab == nil { + // Set deleted slab ID from the end of slabIDsWithOwner. index := len(slabIDsWithOwner) - 1 - deletedSlabCount - slabIDsWithOwner[index] = k + slabIDsWithOwner[index] = id deletedSlabCount++ } else { - slabIDsWithOwner[modifiedSlabCount] = k + // Set modified slab ID from the start of slabIDsWithOwner. + slabIDsWithOwner[modifiedSlabCount] = id modifiedSlabCount++ } }