rlp: remove Iterator.Count

This was introduced together with RawList, but it's slightly unsafe since CountValues
returns zero upon encountering an invalid item. This means the invariant documented on
Count, that it provides an upper bound on the number of visited items, is not true.

Since there are no callers of Count (yet), it's best to just remove it.
This commit is contained in:
Felix Lange 2026-02-13 21:11:06 +01:00
parent 7610cff62a
commit ab06783996

View file

@ -64,15 +64,6 @@ func (it *Iterator) Next() bool {
return true
}
// Count returns the remaining number of items.
// Note this is O(n) and the result may be incorrect if the list data is invalid.
// The returned count is always an upper bound on the remaining items
// that will be visited by the iterator.
func (it *Iterator) Count() int {
count, _ := CountValues(it.data)
return count
}
// Value returns the current value.
func (it *Iterator) Value() []byte {
return it.next