Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
whqwjb
go-ethereum
提交
13c25036
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,发现更多精彩内容 >>
提交
13c25036
编写于
6月 18, 2015
作者:
P
Péter Szilágyi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
eth/fetcher: since uncles are allowed, drop phase test
上级
ecd19919
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
0 addition
and
51 deletion
+0
-51
eth/fetcher/fetcher_test.go
eth/fetcher/fetcher_test.go
+0
-51
未找到文件。
eth/fetcher/fetcher_test.go
浏览文件 @
13c25036
...
...
@@ -395,54 +395,3 @@ func TestDistantDiscarding(t *testing.T) {
t
.
Fatalf
(
"fetcher queued future block"
)
}
}
// Tests that if multiple uncles (i.e. blocks at the same height) are queued for
// importing, then they will get inserted in phases, previous heights needing to
// complete before the next numbered blocks can begin.
func
TestCompetingImports
(
t
*
testing
.
T
)
{
// Generate a few soft-forks for concurrent imports
hashesA
:=
createHashes
(
16
,
knownHash
)
hashesB
:=
createHashes
(
16
,
knownHash
)
hashesC
:=
createHashes
(
16
,
knownHash
)
blocksA
:=
createBlocksFromHashes
(
hashesA
)
blocksB
:=
createBlocksFromHashes
(
hashesB
)
blocksC
:=
createBlocksFromHashes
(
hashesC
)
// Create a tester, and override the import to check number reversals
tester
:=
newTester
()
first
:=
int32
(
1
)
height
:=
uint64
(
1
)
tester
.
fetcher
.
insertChain
=
func
(
blocks
types
.
Blocks
)
(
int
,
error
)
{
// Check for any phase reordering
if
prev
:=
atomic
.
LoadUint64
(
&
height
);
blocks
[
0
]
.
NumberU64
()
<
prev
{
t
.
Errorf
(
"phase reversal: have %v, want %v"
,
blocks
[
0
]
.
NumberU64
(),
prev
)
}
atomic
.
StoreUint64
(
&
height
,
blocks
[
0
]
.
NumberU64
())
// Sleep a bit on the first import not to race with the enqueues
if
atomic
.
CompareAndSwapInt32
(
&
first
,
1
,
0
)
{
time
.
Sleep
(
50
*
time
.
Millisecond
)
}
return
tester
.
insertChain
(
blocks
)
}
// Queue up everything but with a missing link
for
i
:=
0
;
i
<
len
(
hashesA
)
-
2
;
i
++
{
tester
.
fetcher
.
Enqueue
(
"chain A"
,
blocksA
[
hashesA
[
i
]])
tester
.
fetcher
.
Enqueue
(
"chain B"
,
blocksB
[
hashesB
[
i
]])
tester
.
fetcher
.
Enqueue
(
"chain C"
,
blocksC
[
hashesC
[
i
]])
}
// Add the three missing links, and wait for a full import
tester
.
fetcher
.
Enqueue
(
"chain A"
,
blocksA
[
hashesA
[
len
(
hashesA
)
-
2
]])
tester
.
fetcher
.
Enqueue
(
"chain B"
,
blocksB
[
hashesB
[
len
(
hashesB
)
-
2
]])
tester
.
fetcher
.
Enqueue
(
"chain C"
,
blocksC
[
hashesC
[
len
(
hashesC
)
-
2
]])
start
:=
time
.
Now
()
for
len
(
tester
.
hashes
)
!=
len
(
hashesA
)
&&
time
.
Since
(
start
)
<
time
.
Second
{
time
.
Sleep
(
50
*
time
.
Millisecond
)
}
if
len
(
tester
.
hashes
)
!=
len
(
hashesA
)
{
t
.
Fatalf
(
"chain length mismatch: have %v, want %v"
,
len
(
tester
.
hashes
),
len
(
hashesA
))
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录