From ab067839969dff1fd3676d02295dd9a91c692a37 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Fri, 13 Feb 2026 21:11:06 +0100 Subject: [PATCH] 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. --- rlp/iterator.go | 9 --------- 1 file changed, 9 deletions(-) diff --git a/rlp/iterator.go b/rlp/iterator.go index f1f214c4bc..d6151eabd7 100644 --- a/rlp/iterator.go +++ b/rlp/iterator.go @@ -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