good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
514a9472
Commit
514a9472
authored
Feb 19, 2019
by
Matthew Halpern
Committed by
Felix Lange
Feb 19, 2019
Browse files
Options
Downloads
Patches
Plain Diff
trie: prefer nil slices over zero-length slices (#19084)
parent
f1537b77
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
trie/database.go
+1
-1
1 addition, 1 deletion
trie/database.go
trie/proof.go
+1
-1
1 addition, 1 deletion
trie/proof.go
trie/sync.go
+2
-2
2 additions, 2 deletions
trie/sync.go
trie/sync_test.go
+1
-1
1 addition, 1 deletion
trie/sync_test.go
with
5 additions
and
5 deletions
trie/database.go
+
1
−
1
View file @
514a9472
...
...
@@ -809,7 +809,7 @@ func (db *Database) verifyIntegrity() {
db
.
accumulate
(
child
,
reachable
)
}
// Find any unreachable but cached nodes
unreachable
:=
[]
string
{}
var
unreachable
[]
string
for
hash
,
node
:=
range
db
.
dirties
{
if
_
,
ok
:=
reachable
[
hash
];
!
ok
{
unreachable
=
append
(
unreachable
,
fmt
.
Sprintf
(
"%x: {Node: %v, Parents: %d, Prev: %x, Next: %x}"
,
...
...
This diff is collapsed.
Click to expand it.
trie/proof.go
+
1
−
1
View file @
514a9472
...
...
@@ -37,7 +37,7 @@ import (
func
(
t
*
Trie
)
Prove
(
key
[]
byte
,
fromLevel
uint
,
proofDb
ethdb
.
Putter
)
error
{
// Collect all nodes on the path to key.
key
=
keybytesToHex
(
key
)
nodes
:=
[]
node
{}
var
nodes
[]
node
tn
:=
t
.
root
for
len
(
key
)
>
0
&&
tn
!=
nil
{
switch
n
:=
tn
.
(
type
)
{
...
...
This diff is collapsed.
Click to expand it.
trie/sync.go
+
2
−
2
View file @
514a9472
...
...
@@ -157,7 +157,7 @@ func (s *Sync) AddRawEntry(hash common.Hash, depth int, parent common.Hash) {
// Missing retrieves the known missing nodes from the trie for retrieval.
func
(
s
*
Sync
)
Missing
(
max
int
)
[]
common
.
Hash
{
requests
:=
[]
common
.
Hash
{}
var
requests
[]
common
.
Hash
for
!
s
.
queue
.
Empty
()
&&
(
max
==
0
||
len
(
requests
)
<
max
)
{
requests
=
append
(
requests
,
s
.
queue
.
PopItem
()
.
(
common
.
Hash
))
}
...
...
@@ -254,7 +254,7 @@ func (s *Sync) children(req *request, object node) ([]*request, error) {
node
node
depth
int
}
children
:=
[]
child
{}
var
children
[]
child
switch
node
:=
(
object
)
.
(
type
)
{
case
*
shortNode
:
...
...
This diff is collapsed.
Click to expand it.
trie/sync_test.go
+
1
−
1
View file @
514a9472
...
...
@@ -313,7 +313,7 @@ func TestIncompleteSync(t *testing.T) {
triedb
:=
NewDatabase
(
diskdb
)
sched
:=
NewSync
(
srcTrie
.
Hash
(),
diskdb
,
nil
)
added
:=
[]
common
.
Hash
{}
var
added
[]
common
.
Hash
queue
:=
append
([]
common
.
Hash
{},
sched
.
Missing
(
1
)
...
)
for
len
(
queue
)
>
0
{
// Fetch a batch of trie nodes
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment