iavl icon indicating copy to clipboard operation
iavl copied to clipboard

Consider dropping error result from ImmutableTree.Iterator

Open elias-orijtech opened this issue 1 year ago • 0 comments

Right now every caller of ImmutableTree.Iterator must handle its error result, which in turn leads to errors being ignored:

https://github.com/cosmos/iavl/blob/64ffc2749400f762d6279db0fd1ccc2b22e69492/immutable_tree.go#L49

However, the only reason an error can be returned is if IsFastCacheEnabled returns an error, which supposedly is very rare.

A better API is to fall back to NewIterator when IsFastCacheEnabled fails and remove the error result. This benefits every caller, direct and indirect.

CC @odeke-em

elias-orijtech avatar May 03 '23 19:05 elias-orijtech