Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
whqwjb
go-ethereum
提交
be303ba1
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,发现更多精彩内容 >>
提交
be303ba1
编写于
6月 17, 2015
作者:
G
Gustav Simonsson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update ethash Godep (again)
上级
a9d6846f
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
23 addition
and
12 deletion
+23
-12
Godeps/Godeps.json
Godeps/Godeps.json
+2
-2
Godeps/_workspace/src/github.com/ethereum/ethash/ethash.go
Godeps/_workspace/src/github.com/ethereum/ethash/ethash.go
+1
-2
Godeps/_workspace/src/github.com/ethereum/ethash/ethash_test.go
.../_workspace/src/github.com/ethereum/ethash/ethash_test.go
+20
-8
未找到文件。
Godeps/Godeps.json
浏览文件 @
be303ba1
...
...
@@ -21,8 +21,8 @@
},
{
"ImportPath"
:
"github.com/ethereum/ethash"
,
"Comment"
:
"v23.1-222-g
5cfdcba
"
,
"Rev"
:
"
5cfdcba92e634db228d1ddb140e3b7a3c4b38177
"
"Comment"
:
"v23.1-222-g
173b8ff
"
,
"Rev"
:
"
173b8ff953610c13710061e83b95b50c73d7ea50
"
},
{
"ImportPath"
:
"github.com/howeyc/fsnotify"
,
...
...
Godeps/_workspace/src/github.com/ethereum/ethash/ethash.go
浏览文件 @
be303ba1
...
...
@@ -8,7 +8,6 @@ int ethashGoCallback_cgo(unsigned);
import
"C"
import
(
"bytes"
"errors"
"fmt"
"io/ioutil"
...
...
@@ -122,7 +121,7 @@ func (l *Light) Verify(block pow.Block) bool {
}
// avoid mixdigest malleability as it's not included in a block's "hashNononce"
if
!
bytes
.
Equal
(
block
.
MixDigest
()
.
Bytes
(),
C
.
GoBytes
(
unsafe
.
Pointer
(
&
ret
.
mix_hash
),
C
.
int
(
32
))
)
{
if
block
.
MixDigest
()
!=
h256ToHash
(
ret
.
mix_hash
)
{
return
false
}
...
...
Godeps/_workspace/src/github.com/ethereum/ethash/ethash_test.go
浏览文件 @
be303ba1
...
...
@@ -39,6 +39,7 @@ var validBlocks = []*testBlock{
hashNoNonce
:
common
.
HexToHash
(
"372eca2454ead349c3df0ab5d00b0b706b23e49d469387db91811cee0358fc6d"
),
difficulty
:
big
.
NewInt
(
132416
),
nonce
:
0x495732e0ed7a801c
,
mixDigest
:
common
.
HexToHash
(
"2f74cdeb198af0b9abe65d22d372e22fb2d474371774a9583c1cc427a07939f5"
),
},
// from proof of concept nine testnet, epoch 1
{
...
...
@@ -46,6 +47,7 @@ var validBlocks = []*testBlock{
hashNoNonce
:
common
.
HexToHash
(
"7e44356ee3441623bc72a683fd3708fdf75e971bbe294f33e539eedad4b92b34"
),
difficulty
:
big
.
NewInt
(
1532671
),
nonce
:
0x318df1c8adef7e5e
,
mixDigest
:
common
.
HexToHash
(
"144b180aad09ae3c81fb07be92c8e6351b5646dda80e6844ae1b697e55ddde84"
),
},
// from proof of concept nine testnet, epoch 2
{
...
...
@@ -53,6 +55,7 @@ var validBlocks = []*testBlock{
hashNoNonce
:
common
.
HexToHash
(
"5fc898f16035bf5ac9c6d9077ae1e3d5fc1ecc3c9fd5bee8bb00e810fdacbaa0"
),
difficulty
:
big
.
NewInt
(
2467358
),
nonce
:
0x50377003e5d830ca
,
mixDigest
:
common
.
HexToHash
(
"ab546a5b73c452ae86dadd36f0ed83a6745226717d3798832d1b20b489e82063"
),
},
}
...
...
@@ -73,8 +76,9 @@ func TestEthashConcurrentVerify(t *testing.T) {
defer
os
.
RemoveAll
(
eth
.
Full
.
Dir
)
block
:=
&
testBlock
{
difficulty
:
big
.
NewInt
(
10
)}
nonce
,
_
:=
eth
.
Search
(
block
,
nil
)
nonce
,
md
:=
eth
.
Search
(
block
,
nil
)
block
.
nonce
=
nonce
block
.
mixDigest
=
common
.
BytesToHash
(
md
)
// Verify the block concurrently to check for data races.
var
wg
sync
.
WaitGroup
...
...
@@ -98,21 +102,26 @@ func TestEthashConcurrentSearch(t *testing.T) {
eth
.
Turbo
(
true
)
defer
os
.
RemoveAll
(
eth
.
Full
.
Dir
)
// launch n searches concurrently.
type
searchRes
struct
{
n
uint64
md
[]
byte
}
var
(
block
=
&
testBlock
{
difficulty
:
big
.
NewInt
(
35000
)}
nsearch
=
10
wg
=
new
(
sync
.
WaitGroup
)
found
=
make
(
chan
uint64
)
found
=
make
(
chan
searchRes
)
stop
=
make
(
chan
struct
{})
)
rand
.
Read
(
block
.
hashNoNonce
[
:
])
wg
.
Add
(
nsearch
)
// launch n searches concurrently.
for
i
:=
0
;
i
<
nsearch
;
i
++
{
go
func
()
{
nonce
,
_
:=
eth
.
Search
(
block
,
stop
)
nonce
,
md
:=
eth
.
Search
(
block
,
stop
)
select
{
case
found
<-
nonce
:
case
found
<-
searchRes
{
n
:
nonce
,
md
:
md
}
:
case
<-
stop
:
}
wg
.
Done
()
...
...
@@ -120,12 +129,14 @@ func TestEthashConcurrentSearch(t *testing.T) {
}
// wait for one of them to find the nonce
nonce
:=
<-
found
res
:=
<-
found
// stop the others
close
(
stop
)
wg
.
Wait
()
if
block
.
nonce
=
nonce
;
!
eth
.
Verify
(
block
)
{
block
.
nonce
=
res
.
n
block
.
mixDigest
=
common
.
BytesToHash
(
res
.
md
)
if
!
eth
.
Verify
(
block
)
{
t
.
Error
(
"Block could not be verified"
)
}
}
...
...
@@ -140,8 +151,9 @@ func TestEthashSearchAcrossEpoch(t *testing.T) {
for
i
:=
epochLength
-
40
;
i
<
epochLength
+
40
;
i
++
{
block
:=
&
testBlock
{
number
:
i
,
difficulty
:
big
.
NewInt
(
90
)}
rand
.
Read
(
block
.
hashNoNonce
[
:
])
nonce
,
_
:=
eth
.
Search
(
block
,
nil
)
nonce
,
md
:=
eth
.
Search
(
block
,
nil
)
block
.
nonce
=
nonce
block
.
mixDigest
=
common
.
BytesToHash
(
md
)
if
!
eth
.
Verify
(
block
)
{
t
.
Fatalf
(
"Block could not be verified"
)
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录