mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-19 19:30:44 +00:00
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:
parent
7610cff62a
commit
ab06783996
1 changed files with 0 additions and 9 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue