Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
whqwjb
go-ethereum
提交
f30179d6
G
go-ethereum
项目概览
whqwjb
/
go-ethereum
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
go-ethereum
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
f30179d6
编写于
9月 06, 2017
作者:
P
Péter Szilágyi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
eth: disable fast sync after pivot is committed
上级
c4d21bc8
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
12 addition
and
11 deletion
+12
-11
eth/downloader/downloader.go
eth/downloader/downloader.go
+1
-2
eth/sync.go
eth/sync.go
+11
-9
未找到文件。
eth/downloader/downloader.go
浏览文件 @
f30179d6
...
...
@@ -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
浏览文件 @
f30179d6
...
...
@@ -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
)
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录