Skip to content

Commit

Permalink
Cleaner GetBlobHash clauses
Browse files Browse the repository at this point in the history
Co-authored-by: cabrador <84449820+cabrador@users.noreply.github.com>
  • Loading branch information
rpl-ffl and cabrador committed Sep 25, 2024
1 parent 5530997 commit 3627d2a
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions protobuf/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,14 @@ func (msg *Substate_TxMessage) decode(lookup dbGetCode) (*substate.Message, erro
var blobHashes []types.Hash = nil
switch txType {
case Substate_TxMessage_TXTYPE_BLOB:
if msg.GetBlobHashes() != nil {
blobHashes = make([]types.Hash, len(msg.GetBlobHashes()))
for i, hash := range msg.GetBlobHashes() {
blobHashes[i] = types.BytesToHash(hash)
}
}
msgBlobHashes := msg.GetBlobHashes()
if msgBlobHashes == nil {
break
}
blobHashes = make([]types.Hash, len(msgBlobHashes))
for i, hash := range msgBlobHashes {
blobHashes[i] = types.BytesToHash(hash)
}
}

return &substate.Message{
Expand Down

0 comments on commit 3627d2a

Please sign in to comment.