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
6c312a24
Commit
6c312a24
authored
Mar 14, 2019
by
gary rong
Committed by
Péter Szilágyi
Mar 14, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth/downloader: fix ancestor searching for light syncing (#19136)
parent
95b2ec71
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
17 deletions
+19
-17
downloader.go
eth/downloader/downloader.go
+19
-17
No files found.
eth/downloader/downloader.go
View file @
6c312a24
...
@@ -665,10 +665,12 @@ func (d *Downloader) findAncestor(p *peerConnection, remoteHeader *types.Header)
...
@@ -665,10 +665,12 @@ func (d *Downloader) findAncestor(p *peerConnection, remoteHeader *types.Header)
localHeight
=
d
.
lightchain
.
CurrentHeader
()
.
Number
.
Uint64
()
localHeight
=
d
.
lightchain
.
CurrentHeader
()
.
Number
.
Uint64
()
}
}
p
.
log
.
Debug
(
"Looking for common ancestor"
,
"local"
,
localHeight
,
"remote"
,
remoteHeight
)
p
.
log
.
Debug
(
"Looking for common ancestor"
,
"local"
,
localHeight
,
"remote"
,
remoteHeight
)
// Recap floor value for binary search
if
localHeight
>=
MaxForkAncestry
{
if
localHeight
>=
MaxForkAncestry
{
// We're above the max reorg threshold, find the earliest fork point
// We're above the max reorg threshold, find the earliest fork point
floor
=
int64
(
localHeight
-
MaxForkAncestry
)
floor
=
int64
(
localHeight
-
MaxForkAncestry
)
}
// If we're doing a light sync, ensure the floor doesn't go below the CHT, as
// If we're doing a light sync, ensure the floor doesn't go below the CHT, as
// all headers before that point will be missing.
// all headers before that point will be missing.
if
d
.
mode
==
LightSync
{
if
d
.
mode
==
LightSync
{
...
@@ -688,7 +690,7 @@ func (d *Downloader) findAncestor(p *peerConnection, remoteHeader *types.Header)
...
@@ -688,7 +690,7 @@ func (d *Downloader) findAncestor(p *peerConnection, remoteHeader *types.Header)
floor
=
int64
(
d
.
genesis
)
-
1
floor
=
int64
(
d
.
genesis
)
-
1
}
}
}
}
}
from
,
count
,
skip
,
max
:=
calculateRequestSpan
(
remoteHeight
,
localHeight
)
from
,
count
,
skip
,
max
:=
calculateRequestSpan
(
remoteHeight
,
localHeight
)
p
.
log
.
Trace
(
"Span searching for common ancestor"
,
"count"
,
count
,
"from"
,
from
,
"skip"
,
skip
)
p
.
log
.
Trace
(
"Span searching for common ancestor"
,
"count"
,
count
,
"from"
,
from
,
"skip"
,
skip
)
...
...
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