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
55e5926f
Commit
55e5926f
authored
Sep 07, 2017
by
Péter Szilágyi
Committed by
GitHub
Sep 07, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15103 from karalabe/disable-fastsync-postpivot
eth: disable fast sync after pivot is committed
parents
c4d21bc8
f30179d6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
11 deletions
+12
-11
downloader.go
eth/downloader/downloader.go
+1
-2
sync.go
eth/sync.go
+11
-9
No files found.
eth/downloader/downloader.go
View file @
55e5926f
...
...
@@ -1170,7 +1170,7 @@ func (d *Downloader) processHeaders(origin uint64, td *big.Int) error {
// If we're already past the pivot point, this could be an attack, thread carefully
if
rollback
[
len
(
rollback
)
-
1
]
.
Number
.
Uint64
()
>
pivot
{
// If we didn't ever fail, lock in te pivot header (must! not! change!)
// If we didn't ever fail, lock in t
h
e pivot header (must! not! change!)
if
atomic
.
LoadUint32
(
&
d
.
fsPivotFails
)
==
0
{
for
_
,
header
:=
range
rollback
{
if
header
.
Number
.
Uint64
()
==
pivot
{
...
...
@@ -1392,7 +1392,6 @@ func (d *Downloader) processFastSyncContent(latest *types.Header) error {
stateSync
.
Cancel
()
if
err
:=
d
.
commitPivotBlock
(
P
);
err
!=
nil
{
return
err
}
}
if
err
:=
d
.
importBlockResults
(
afterP
);
err
!=
nil
{
...
...
eth/sync.go
View file @
55e5926f
...
...
@@ -188,7 +188,17 @@ func (pm *ProtocolManager) synchronise(peer *peer) {
atomic
.
StoreUint32
(
&
pm
.
fastSync
,
1
)
mode
=
downloader
.
FastSync
}
if
err
:=
pm
.
downloader
.
Synchronise
(
peer
.
id
,
pHead
,
pTd
,
mode
);
err
!=
nil
{
// Run the sync cycle, and disable fast sync if we've went past the pivot block
err
:=
pm
.
downloader
.
Synchronise
(
peer
.
id
,
pHead
,
pTd
,
mode
)
if
atomic
.
LoadUint32
(
&
pm
.
fastSync
)
==
1
{
// Disable fast sync if we indeed have something in our chain
if
pm
.
blockchain
.
CurrentBlock
()
.
NumberU64
()
>
0
{
log
.
Info
(
"Fast sync complete, auto disabling"
)
atomic
.
StoreUint32
(
&
pm
.
fastSync
,
0
)
}
}
if
err
!=
nil
{
return
}
atomic
.
StoreUint32
(
&
pm
.
acceptTxs
,
1
)
// Mark initial sync done
...
...
@@ -201,12 +211,4 @@ func (pm *ProtocolManager) synchronise(peer *peer) {
// more reliably update peers or the local TD state.
go
pm
.
BroadcastBlock
(
head
,
false
)
}
// If fast sync was enabled, and we synced up, disable it
if
atomic
.
LoadUint32
(
&
pm
.
fastSync
)
==
1
{
// Disable fast sync if we indeed have something in our chain
if
pm
.
blockchain
.
CurrentBlock
()
.
NumberU64
()
>
0
{
log
.
Info
(
"Fast sync complete, auto disabling"
)
atomic
.
StoreUint32
(
&
pm
.
fastSync
,
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