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
dc6e98d2
Unverified
Commit
dc6e98d2
authored
Mar 18, 2020
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth: when triggering a sync, check the head header TD, not block
parent
5dd0cd12
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
handler.go
eth/handler.go
+2
-2
sync.go
eth/sync.go
+2
-2
No files found.
eth/handler.go
View file @
dc6e98d2
...
...
@@ -727,8 +727,8 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
// Schedule a sync if above ours. Note, this will not fire a sync for a gap of
// a single block (as the true TD is below the propagated block), however this
// scenario should easily be covered by the fetcher.
current
Block
:=
pm
.
blockchain
.
CurrentBlock
()
if
trueTD
.
Cmp
(
pm
.
blockchain
.
GetTd
(
current
Block
.
Hash
(),
currentBlock
.
NumberU
64
()))
>
0
{
current
Header
:=
pm
.
blockchain
.
CurrentHeader
()
if
trueTD
.
Cmp
(
pm
.
blockchain
.
GetTd
(
current
Header
.
Hash
(),
currentHeader
.
Number
.
Uint
64
()))
>
0
{
go
pm
.
synchronise
(
p
)
}
}
...
...
eth/sync.go
View file @
dc6e98d2
...
...
@@ -189,8 +189,8 @@ func (pm *ProtocolManager) synchronise(peer *peer) {
return
}
// Make sure the peer's TD is higher than our own
current
Block
:=
pm
.
blockchain
.
CurrentBlock
()
td
:=
pm
.
blockchain
.
GetTd
(
current
Block
.
Hash
(),
currentBlock
.
NumberU
64
())
current
Header
:=
pm
.
blockchain
.
CurrentHeader
()
td
:=
pm
.
blockchain
.
GetTd
(
current
Header
.
Hash
(),
currentHeader
.
Number
.
Uint
64
())
pHead
,
pTd
:=
peer
.
Head
()
if
pTd
.
Cmp
(
td
)
<=
0
{
...
...
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