Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Commit

Permalink
Check for error before logic. (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
adlerjohn authored Jul 26, 2021
1 parent 2c90766 commit ccbebc9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion deepsubtree.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,8 @@ func (smt *SparseMerkleTree) GetDescend(key []byte) ([]byte, error) {
// Errors if the key cannot be reached by descending.
func (smt *SparseMerkleTree) HasDescend(key []byte) (bool, error) {
val, err := smt.GetDescend(key)
return !bytes.Equal(defaultValue, val), err
if err != nil {
return false, err
}
return !bytes.Equal(defaultValue, val), nil
}

0 comments on commit ccbebc9

Please sign in to comment.