Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
b30b9ab8
Commit
b30b9ab8
authored
Feb 25, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed a minor issue where a string is expected but returns slice
parent
0afdedb0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
13 deletions
+10
-13
trie.go
ethutil/trie.go
+2
-2
trie_test.go
ethutil/trie_test.go
+8
-11
No files found.
ethutil/trie.go
View file @
b30b9ab8
...
...
@@ -439,7 +439,7 @@ func (it *TrieIterator) workNode(currentNode *Value) {
if
currentNode
.
Len
()
==
2
{
k
:=
CompactDecode
(
currentNode
.
Get
(
0
)
.
Str
())
if
currentNode
.
Get
(
1
)
.
IsSlice
()
{
if
currentNode
.
Get
(
1
)
.
Str
()
==
""
{
it
.
workNode
(
currentNode
.
Get
(
1
))
}
else
{
if
k
[
len
(
k
)
-
1
]
==
16
{
...
...
@@ -454,7 +454,7 @@ func (it *TrieIterator) workNode(currentNode *Value) {
if
i
==
16
&&
currentNode
.
Get
(
i
)
.
Len
()
!=
0
{
it
.
values
=
append
(
it
.
values
,
currentNode
.
Get
(
i
)
.
Str
())
}
else
{
if
currentNode
.
Get
(
i
)
.
IsSlice
()
{
if
currentNode
.
Get
(
i
)
.
Str
()
==
""
{
it
.
workNode
(
currentNode
.
Get
(
i
))
}
else
{
val
:=
currentNode
.
Get
(
i
)
.
Str
()
...
...
ethutil/trie_test.go
View file @
b30b9ab8
package
ethutil
import
(
"fmt"
"reflect"
"testing"
)
...
...
@@ -160,15 +159,13 @@ func TestTrieIterator(t *testing.T) {
trie
.
Update
(
"ca"
,
LONG_WORD
)
trie
.
Update
(
"cat"
,
LONG_WORD
)
lenBefore
:=
len
(
trie
.
cache
.
nodes
)
it
:=
trie
.
NewIterator
()
fmt
.
Println
(
"purging"
)
fmt
.
Println
(
"len ="
,
it
.
Purge
())
/*
for it.Next() {
k := it.Key()
v := it.Value()
fmt.Println(k, v)
}
*/
if
num
:=
it
.
Purge
();
num
!=
3
{
t
.
Errorf
(
"Expected purge to return 3, got %d"
,
num
)
}
if
lenBefore
==
len
(
trie
.
cache
.
nodes
)
{
t
.
Errorf
(
"Expected cached nodes to be deleted"
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment