Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
whqwjb
go-ethereum
提交
7c60d0a6
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,体验更适合开发者的 AI 搜索 >>
提交
7c60d0a6
编写于
2月 05, 2019
作者:
L
lash
提交者:
Anton Evangelatov
2月 05, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
swarm/pss: Remove pss service leak in test (#18992)
上级
1c3aa8d9
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
11 addition
and
0 deletion
+11
-0
swarm/pss/forwarding_test.go
swarm/pss/forwarding_test.go
+1
-0
swarm/pss/pss_test.go
swarm/pss/pss_test.go
+10
-0
未找到文件。
swarm/pss/forwarding_test.go
浏览文件 @
7c60d0a6
...
...
@@ -54,6 +54,7 @@ func TestForwardBasic(t *testing.T) {
kad
:=
network
.
NewKademlia
(
base
[
:
],
network
.
NewKadParams
())
ps
:=
createPss
(
t
,
kad
)
defer
ps
.
Stop
()
addPeers
(
kad
,
peerAddresses
)
const
firstNearest
=
depth
*
2
// shallowest peer in the nearest neighbours' bin
...
...
swarm/pss/pss_test.go
浏览文件 @
7c60d0a6
...
...
@@ -170,6 +170,7 @@ func TestCache(t *testing.T) {
t
.
Fatal
(
err
)
}
ps
:=
newTestPss
(
privkey
,
nil
,
nil
)
defer
ps
.
Stop
()
pp
:=
NewPssParams
()
.
WithPrivateKey
(
privkey
)
data
:=
[]
byte
(
"foo"
)
datatwo
:=
[]
byte
(
"bar"
)
...
...
@@ -648,6 +649,7 @@ func TestMessageProcessing(t *testing.T) {
addr
:=
make
([]
byte
,
32
)
addr
[
0
]
=
0x01
ps
:=
newTestPss
(
privkey
,
network
.
NewKademlia
(
addr
,
network
.
NewKadParams
()),
NewPssParams
())
defer
ps
.
Stop
()
// message should pass
msg
:=
newPssMsg
(
&
msgParams
{})
...
...
@@ -780,6 +782,7 @@ func TestKeys(t *testing.T) {
t
.
Fatalf
(
"failed to retrieve 'their' private key"
)
}
ps
:=
newTestPss
(
ourprivkey
,
nil
,
nil
)
defer
ps
.
Stop
()
// set up peer with mock address, mapped to mocked publicaddress and with mocked symkey
addr
:=
make
(
PssAddress
,
32
)
...
...
@@ -829,6 +832,7 @@ func TestGetPublickeyEntries(t *testing.T) {
t
.
Fatal
(
err
)
}
ps
:=
newTestPss
(
privkey
,
nil
,
nil
)
defer
ps
.
Stop
()
peeraddr
:=
network
.
RandomAddr
()
.
Over
()
topicaddr
:=
make
(
map
[
Topic
]
PssAddress
)
...
...
@@ -932,6 +936,7 @@ func TestPeerCapabilityMismatch(t *testing.T) {
Payload
:
&
whisper
.
Envelope
{},
}
ps
:=
newTestPss
(
privkey
,
kad
,
nil
)
defer
ps
.
Stop
()
// run the forward
// it is enough that it completes; trying to send to incapable peers would create segfault
...
...
@@ -950,6 +955,7 @@ func TestRawAllow(t *testing.T) {
baseAddr
:=
network
.
RandomAddr
()
kad
:=
network
.
NewKademlia
((
baseAddr
)
.
Over
(),
network
.
NewKadParams
())
ps
:=
newTestPss
(
privKey
,
kad
,
nil
)
defer
ps
.
Stop
()
topic
:=
BytesToTopic
([]
byte
{
0x2a
})
// create handler innards that increments every time a message hits it
...
...
@@ -1691,6 +1697,7 @@ func benchmarkSymKeySend(b *testing.B) {
keys
,
err
:=
wapi
.
NewKeyPair
(
ctx
)
privkey
,
err
:=
w
.
GetPrivateKey
(
keys
)
ps
:=
newTestPss
(
privkey
,
nil
,
nil
)
defer
ps
.
Stop
()
msg
:=
make
([]
byte
,
msgsize
)
rand
.
Read
(
msg
)
topic
:=
BytesToTopic
([]
byte
(
"foo"
))
...
...
@@ -1735,6 +1742,7 @@ func benchmarkAsymKeySend(b *testing.B) {
keys
,
err
:=
wapi
.
NewKeyPair
(
ctx
)
privkey
,
err
:=
w
.
GetPrivateKey
(
keys
)
ps
:=
newTestPss
(
privkey
,
nil
,
nil
)
defer
ps
.
Stop
()
msg
:=
make
([]
byte
,
msgsize
)
rand
.
Read
(
msg
)
topic
:=
BytesToTopic
([]
byte
(
"foo"
))
...
...
@@ -1785,6 +1793,7 @@ func benchmarkSymkeyBruteforceChangeaddr(b *testing.B) {
}
else
{
ps
=
newTestPss
(
privkey
,
nil
,
nil
)
}
defer
ps
.
Stop
()
topic
:=
BytesToTopic
([]
byte
(
"foo"
))
for
i
:=
0
;
i
<
int
(
keycount
);
i
++
{
to
:=
make
(
PssAddress
,
32
)
...
...
@@ -1868,6 +1877,7 @@ func benchmarkSymkeyBruteforceSameaddr(b *testing.B) {
}
else
{
ps
=
newTestPss
(
privkey
,
nil
,
nil
)
}
defer
ps
.
Stop
()
topic
:=
BytesToTopic
([]
byte
(
"foo"
))
for
i
:=
0
;
i
<
int
(
keycount
);
i
++
{
copy
(
addr
[
i
],
network
.
RandomAddr
()
.
Over
())
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录