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
024b22c3
Commit
024b22c3
authored
Sep 29, 2018
by
Wenbiao Zheng
Committed by
Felix Lange
Sep 29, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth/downloader: use intermediate variable for better readability (#17510)
parent
ffca6dfe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
downloader.go
eth/downloader/downloader.go
+8
-4
No files found.
eth/downloader/downloader.go
View file @
024b22c3
...
...
@@ -658,8 +658,10 @@ func (d *Downloader) findAncestor(p *peerConnection, height uint64) (uint64, err
continue
}
// Otherwise check if we already know the header or not
if
(
d
.
mode
==
FullSync
&&
d
.
blockchain
.
HasBlock
(
headers
[
i
]
.
Hash
(),
headers
[
i
]
.
Number
.
Uint64
()))
||
(
d
.
mode
!=
FullSync
&&
d
.
lightchain
.
HasHeader
(
headers
[
i
]
.
Hash
(),
headers
[
i
]
.
Number
.
Uint64
()))
{
number
,
hash
=
headers
[
i
]
.
Number
.
Uint64
(),
headers
[
i
]
.
Hash
()
h
:=
headers
[
i
]
.
Hash
()
n
:=
headers
[
i
]
.
Number
.
Uint64
()
if
(
d
.
mode
==
FullSync
&&
d
.
blockchain
.
HasBlock
(
h
,
n
))
||
(
d
.
mode
!=
FullSync
&&
d
.
lightchain
.
HasHeader
(
h
,
n
))
{
number
,
hash
=
n
,
h
// If every header is known, even future ones, the peer straight out lied about its head
if
number
>
height
&&
i
==
limit
-
1
{
...
...
@@ -723,11 +725,13 @@ func (d *Downloader) findAncestor(p *peerConnection, height uint64) (uint64, err
arrived
=
true
// Modify the search interval based on the response
if
(
d
.
mode
==
FullSync
&&
!
d
.
blockchain
.
HasBlock
(
headers
[
0
]
.
Hash
(),
headers
[
0
]
.
Number
.
Uint64
()))
||
(
d
.
mode
!=
FullSync
&&
!
d
.
lightchain
.
HasHeader
(
headers
[
0
]
.
Hash
(),
headers
[
0
]
.
Number
.
Uint64
()))
{
h
:=
headers
[
0
]
.
Hash
()
n
:=
headers
[
0
]
.
Number
.
Uint64
()
if
(
d
.
mode
==
FullSync
&&
!
d
.
blockchain
.
HasBlock
(
h
,
n
))
||
(
d
.
mode
!=
FullSync
&&
!
d
.
lightchain
.
HasHeader
(
h
,
n
))
{
end
=
check
break
}
header
:=
d
.
lightchain
.
GetHeaderByHash
(
h
eaders
[
0
]
.
Hash
()
)
// Independent of sync mode, header surely exists
header
:=
d
.
lightchain
.
GetHeaderByHash
(
h
)
// Independent of sync mode, header surely exists
if
header
.
Number
.
Uint64
()
!=
check
{
p
.
log
.
Debug
(
"Received non requested header"
,
"number"
,
header
.
Number
,
"hash"
,
header
.
Hash
(),
"request"
,
check
)
return
0
,
errBadPeer
...
...
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