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
7641bbe5
Commit
7641bbe5
authored
Jun 05, 2019
by
gary rong
Committed by
Felix Lange
Jun 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth/downloader: make syncing error more obvious (#19413)
parent
645756cd
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
42 deletions
+45
-42
downloader.go
eth/downloader/downloader.go
+34
-35
downloader_test.go
eth/downloader/downloader_test.go
+0
-6
statesync.go
eth/downloader/statesync.go
+11
-1
No files found.
eth/downloader/downloader.go
View file @
7641bbe5
This diff is collapsed.
Click to expand it.
eth/downloader/downloader_test.go
View file @
7641bbe5
...
...
@@ -1114,14 +1114,8 @@ func testBlockHeaderAttackerDropping(t *testing.T, protocol int) {
{
errPeersUnavailable
,
true
},
// Nobody had the advertised blocks, drop the advertiser
{
errInvalidAncestor
,
true
},
// Agreed upon ancestor is not acceptable, drop the chain rewriter
{
errInvalidChain
,
true
},
// Hash chain was detected as invalid, definitely drop
{
errInvalidBlock
,
false
},
// A bad peer was detected, but not the sync origin
{
errInvalidBody
,
false
},
// A bad peer was detected, but not the sync origin
{
errInvalidReceipt
,
false
},
// A bad peer was detected, but not the sync origin
{
errCancelBlockFetch
,
false
},
// Synchronisation was canceled, origin may be innocent, don't drop
{
errCancelHeaderFetch
,
false
},
// Synchronisation was canceled, origin may be innocent, don't drop
{
errCancelBodyFetch
,
false
},
// Synchronisation was canceled, origin may be innocent, don't drop
{
errCancelReceiptFetch
,
false
},
// Synchronisation was canceled, origin may be innocent, don't drop
{
errCancelHeaderProcessing
,
false
},
// Synchronisation was canceled, origin may be innocent, don't drop
{
errCancelContentProcessing
,
false
},
// Synchronisation was canceled, origin may be innocent, don't drop
}
// Run the tests and check disconnection status
...
...
eth/downloader/statesync.go
View file @
7641bbe5
...
...
@@ -302,7 +302,7 @@ func (s *stateSync) loop() (err error) {
return
errCancelStateFetch
case
<-
s
.
d
.
cancelCh
:
return
errCancel
StateFetch
return
errCancel
ed
case
req
:=
<-
s
.
deliver
:
// Response, disconnect or timeout triggered, drop the peer if stalling
...
...
@@ -317,6 +317,16 @@ func (s *stateSync) loop() (err error) {
req
.
peer
.
log
.
Warn
(
"Downloader wants to drop peer, but peerdrop-function is not set"
,
"peer"
,
req
.
peer
.
id
)
}
else
{
s
.
d
.
dropPeer
(
req
.
peer
.
id
)
// If this peer was the master peer, abort sync immediately
s
.
d
.
cancelLock
.
RLock
()
master
:=
req
.
peer
.
id
==
s
.
d
.
cancelPeer
s
.
d
.
cancelLock
.
RUnlock
()
if
master
{
s
.
d
.
cancel
()
return
errTimeout
}
}
}
// Process all the received blobs and check for stale delivery
...
...
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