Skip to content

Commit

Permalink
Remove redundant error checks
Browse files Browse the repository at this point in the history
  • Loading branch information
khssnv committed Mar 11, 2024
1 parent 33d40c3 commit 032c4fd
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions blockchain/pallets/primitives.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,30 +97,23 @@ func (m *StorageNodeMode) Decode(decoder scale.Decoder) error {
return ErrUnknownVariant
}

if err != nil {
return err
}

return nil
}

func (m StorageNodeMode) Encode(encoder scale.Encoder) error {
var err1, err2 error
var err error
if m.IsFull {
err1 = encoder.PushByte(1)
err = encoder.PushByte(1)
} else if m.IsStorage {
err1 = encoder.PushByte(2)
err = encoder.PushByte(2)
} else if m.IsCache {
err1 = encoder.PushByte(3)
err = encoder.PushByte(3)
} else {
return ErrUnknownVariant
}

if err1 != nil {
return err1
}
if err2 != nil {
return err2
if err != nil {
return err
}

return nil
Expand Down

0 comments on commit 032c4fd

Please sign in to comment.