it can potentially return (true, non-nil error) which is an odd return composite, we’d expect to have either:
(true, nil error)
(false, non-nil error)
If at any point defaultValue changes, the current assumption of bytes.Equal((*bytes)(nil), []byte{}) will fail so it is safer to fool proof that code by just checking the error from GetDescend firstly.
Good catch. To document for posterity, #39 introduced non-trivial changes to the logic for getting leaves, so not unexpected there's still a few kinks to iron out.
A minor nit, but if we look at the code in https://github.com/celestiaorg/smt/blob/2c9076637cd90849e6e37a0be715973586568329/deepsubtree.go#L123-L126
it can potentially return (true, non-nil error) which is an odd return composite, we’d expect to have either: (true, nil error) (false, non-nil error)
If at any point defaultValue changes, the current assumption of bytes.Equal((*bytes)(nil), []byte{}) will fail so it is safer to fool proof that code by just checking the error from GetDescend firstly.