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
afdd23b5
Unverified
Commit
afdd23b5
authored
May 26, 2017
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth: don't import propagated blocks during fastsync
parent
cb809c03
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
0 deletions
+6
-0
handler.go
eth/handler.go
+5
-0
sync.go
eth/sync.go
+1
-0
No files found.
eth/handler.go
View file @
afdd23b5
...
...
@@ -171,6 +171,11 @@ func NewProtocolManager(config *params.ChainConfig, mode downloader.SyncMode, ne
return
blockchain
.
CurrentBlock
()
.
NumberU64
()
}
inserter
:=
func
(
blocks
types
.
Blocks
)
(
int
,
error
)
{
// If fast sync is running, deny importing weird blocks
if
atomic
.
LoadUint32
(
&
manager
.
fastSync
)
==
1
{
log
.
Warn
(
"Discarded bad propagated block"
,
"number"
,
blocks
[
0
]
.
Number
(),
"hash"
,
blocks
[
0
]
.
Hash
())
return
0
,
nil
}
atomic
.
StoreUint32
(
&
manager
.
acceptTxs
,
1
)
// Mark initial sync done on any fetcher import
return
manager
.
blockchain
.
InsertChain
(
blocks
)
}
...
...
eth/sync.go
View file @
afdd23b5
...
...
@@ -183,6 +183,7 @@ func (pm *ProtocolManager) synchronise(peer *peer) {
// The only scenario where this can happen is if the user manually (or via a
// bad block) rolled back a fast sync node below the sync point. In this case
// however it's safe to reenable fast sync.
atomic
.
StoreUint32
(
&
pm
.
fastSync
,
1
)
mode
=
downloader
.
FastSync
}
if
err
:=
pm
.
downloader
.
Synchronise
(
peer
.
id
,
pHead
,
pTd
,
mode
);
err
!=
nil
{
...
...
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