Skip to content

Commit

Permalink
Refactor getAccountStorageFormat()
Browse files Browse the repository at this point in the history
Co-authored-by: Bastian Müller <[email protected]>
  • Loading branch information
fxamacker and turbolent authored Nov 25, 2024
1 parent 9af92f6 commit c7cf012
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions runtime/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,12 +301,16 @@ func (s *Storage) getAccountStorageFormat(
return storageFormatNew
}

func (s *Storage) getCachedAccountFormat(address common.Address) (isV1 bool, isV2 bool) {
func (s *Storage) getCachedAccountFormat(address common.Address) (format storageFormat, known bool) {
isV1, cached := s.cachedV1Accounts[address]
if !cached {
return false, false
return storageFormatUnknown, false
}
if isV1 {
return storageFormatV1, true
} else {
return StorageFormatV2, true
}
return isV1, !isV1
}

// isV2Account returns true if given account is in account storage format v2.
Expand Down

0 comments on commit c7cf012

Please sign in to comment.