Skip to content

Commit 7577b9c

Browse files
authored
core/state: unexport NodeIterator (#27239)
1 parent d17ec0e commit 7577b9c

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

core/state/iterator.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ import (
2626
"github.com/ethereum/go-ethereum/trie"
2727
)
2828

29-
// NodeIterator is an iterator to traverse the entire state trie post-order,
29+
// nodeIterator is an iterator to traverse the entire state trie post-order,
3030
// including all of the contract code and contract state tries.
31-
type NodeIterator struct {
31+
type nodeIterator struct {
3232
state *StateDB // State being iterated
3333

3434
stateIt trie.NodeIterator // Primary iterator for the global state trie
@@ -44,17 +44,17 @@ type NodeIterator struct {
4444
Error error // Failure set in case of an internal error in the iterator
4545
}
4646

47-
// NewNodeIterator creates an post-order state node iterator.
48-
func NewNodeIterator(state *StateDB) *NodeIterator {
49-
return &NodeIterator{
47+
// newNodeIterator creates an post-order state node iterator.
48+
func newNodeIterator(state *StateDB) *nodeIterator {
49+
return &nodeIterator{
5050
state: state,
5151
}
5252
}
5353

5454
// Next moves the iterator to the next node, returning whether there are any
5555
// further nodes. In case of an internal error this method returns false and
5656
// sets the Error field to the encountered failure.
57-
func (it *NodeIterator) Next() bool {
57+
func (it *nodeIterator) Next() bool {
5858
// If the iterator failed previously, don't do anything
5959
if it.Error != nil {
6060
return false
@@ -68,7 +68,7 @@ func (it *NodeIterator) Next() bool {
6868
}
6969

7070
// step moves the iterator to the next entry of the state trie.
71-
func (it *NodeIterator) step() error {
71+
func (it *nodeIterator) step() error {
7272
// Abort if we reached the end of the iteration
7373
if it.state == nil {
7474
return nil
@@ -131,7 +131,7 @@ func (it *NodeIterator) step() error {
131131

132132
// retrieve pulls and caches the current state entry the iterator is traversing.
133133
// The method returns whether there are any more data left for inspection.
134-
func (it *NodeIterator) retrieve() bool {
134+
func (it *nodeIterator) retrieve() bool {
135135
// Clear out any previously set values
136136
it.Hash = common.Hash{}
137137

core/state/iterator_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func TestNodeIteratorCoverage(t *testing.T) {
3636
}
3737
// Gather all the node hashes found by the iterator
3838
hashes := make(map[common.Hash]struct{})
39-
for it := NewNodeIterator(state); it.Next(); {
39+
for it := newNodeIterator(state); it.Next(); {
4040
if it.Hash != (common.Hash{}) {
4141
hashes[it.Hash] = struct{}{}
4242
}

core/state/sync_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func checkStateConsistency(db ethdb.Database, root common.Hash) error {
125125
if err != nil {
126126
return err
127127
}
128-
it := NewNodeIterator(state)
128+
it := newNodeIterator(state)
129129
for it.Next() {
130130
}
131131
return it.Error

0 commit comments

Comments
 (0)