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
174083c3
Unverified
Commit
174083c3
authored
Nov 28, 2018
by
Péter Szilágyi
Browse files
Options
Downloads
Patches
Plain Diff
eth/downloader: fix light client cht binary search issue
parent
bfed28a4
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
eth/downloader/downloader.go
+22
-0
22 additions, 0 deletions
eth/downloader/downloader.go
with
22 additions
and
0 deletions
eth/downloader/downloader.go
+
22
−
0
View file @
174083c3
...
...
@@ -99,6 +99,7 @@ type Downloader struct {
mode
SyncMode
// Synchronisation mode defining the strategy used (per sync cycle)
mux
*
event
.
TypeMux
// Event multiplexer to announce sync operation events
genesis
uint64
// Genesis block number to limit sync to (e.g. light client CHT)
queue
*
queue
// Scheduler for selecting the hashes to download
peers
*
peerSet
// Set of active peers from which download can proceed
stateDB
ethdb
.
Database
...
...
@@ -664,7 +665,28 @@ func (d *Downloader) findAncestor(p *peerConnection, remoteHeader *types.Header)
}
p
.
log
.
Debug
(
"Looking for common ancestor"
,
"local"
,
localHeight
,
"remote"
,
remoteHeight
)
if
localHeight
>=
MaxForkAncestry
{
// We're above the max reorg threshold, find the earliest fork point
floor
=
int64
(
localHeight
-
MaxForkAncestry
)
// 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.
if
d
.
mode
==
LightSync
{
// If we dont know the current CHT position, find it
if
d
.
genesis
==
0
{
header
:=
d
.
lightchain
.
CurrentHeader
()
for
header
!=
nil
{
d
.
genesis
=
header
.
Number
.
Uint64
()
if
floor
>=
int64
(
d
.
genesis
)
-
1
{
break
}
header
=
d
.
lightchain
.
GetHeaderByHash
(
header
.
ParentHash
)
}
}
// We already know the "genesis" block number, cap floor to that
if
floor
<
int64
(
d
.
genesis
)
-
1
{
floor
=
int64
(
d
.
genesis
)
-
1
}
}
}
from
,
count
,
skip
,
max
:=
calculateRequestSpan
(
remoteHeight
,
localHeight
)
...
...
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