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
ac5e28ea
Unverified
Commit
ac5e28ea
authored
Nov 19, 2019
by
Felix Lange
Committed by
GitHub
Nov 19, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
whisper/whisperv6: fix staticcheck warnings (#20328)
parent
3b0f3483
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
29 deletions
+3
-29
filter_test.go
whisper/whisperv6/filter_test.go
+2
-8
peer_test.go
whisper/whisperv6/peer_test.go
+1
-21
No files found.
whisper/whisperv6/filter_test.go
View file @
ac5e28ea
...
@@ -36,11 +36,6 @@ func InitSingleTest() {
...
@@ -36,11 +36,6 @@ func InitSingleTest() {
mrand
.
Seed
(
seed
)
mrand
.
Seed
(
seed
)
}
}
func
InitDebugTest
(
i
int64
)
{
seed
=
i
mrand
.
Seed
(
seed
)
}
type
FilterTestCase
struct
{
type
FilterTestCase
struct
{
f
*
Filter
f
*
Filter
id
string
id
string
...
@@ -309,8 +304,7 @@ func TestMatchEnvelope(t *testing.T) {
...
@@ -309,8 +304,7 @@ func TestMatchEnvelope(t *testing.T) {
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatalf
(
"failed to create new message with seed %d: %s."
,
seed
,
err
)
t
.
Fatalf
(
"failed to create new message with seed %d: %s."
,
seed
,
err
)
}
}
env
,
err
:=
msg
.
Wrap
(
params
)
if
_
,
err
=
msg
.
Wrap
(
params
);
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatalf
(
"failed Wrap with seed %d: %s."
,
seed
,
err
)
t
.
Fatalf
(
"failed Wrap with seed %d: %s."
,
seed
,
err
)
}
}
...
@@ -322,7 +316,7 @@ func TestMatchEnvelope(t *testing.T) {
...
@@ -322,7 +316,7 @@ func TestMatchEnvelope(t *testing.T) {
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatalf
(
"failed to create new message with seed %d: %s."
,
seed
,
err
)
t
.
Fatalf
(
"failed to create new message with seed %d: %s."
,
seed
,
err
)
}
}
env
,
err
=
msg
.
Wrap
(
params
)
env
,
err
:
=
msg
.
Wrap
(
params
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatalf
(
"failed Wrap() with seed %d: %s."
,
seed
,
err
)
t
.
Fatalf
(
"failed Wrap() with seed %d: %s."
,
seed
,
err
)
}
}
...
...
whisper/whisperv6/peer_test.go
View file @
ac5e28ea
...
@@ -22,7 +22,6 @@ import (
...
@@ -22,7 +22,6 @@ import (
"fmt"
"fmt"
mrand
"math/rand"
mrand
"math/rand"
"sync"
"sync"
"sync/atomic"
"testing"
"testing"
"time"
"time"
...
@@ -74,7 +73,6 @@ var keys = []string{
...
@@ -74,7 +73,6 @@ var keys = []string{
}
}
type
TestData
struct
{
type
TestData
struct
{
started
int64
counter
[
NumNodes
]
int
counter
[
NumNodes
]
int
mutex
sync
.
RWMutex
mutex
sync
.
RWMutex
}
}
...
@@ -212,13 +210,10 @@ func initialize(t *testing.T) {
...
@@ -212,13 +210,10 @@ func initialize(t *testing.T) {
},
},
}
}
go
startServer
(
t
,
node
.
server
)
startServer
(
t
,
node
.
server
)
nodes
[
i
]
=
&
node
nodes
[
i
]
=
&
node
}
}
waitForServersToStart
(
t
)
for
i
:=
0
;
i
<
NumNodes
;
i
++
{
for
i
:=
0
;
i
<
NumNodes
;
i
++
{
for
j
:=
0
;
j
<
i
;
j
++
{
for
j
:=
0
;
j
<
i
;
j
++
{
peerNodeId
:=
nodes
[
j
]
.
id
peerNodeId
:=
nodes
[
j
]
.
id
...
@@ -234,8 +229,6 @@ func startServer(t *testing.T, s *p2p.Server) {
...
@@ -234,8 +229,6 @@ func startServer(t *testing.T, s *p2p.Server) {
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Fatalf
(
"failed to start the first server. err: %v"
,
err
)
t
.
Fatalf
(
"failed to start the first server. err: %v"
,
err
)
}
}
atomic
.
AddInt64
(
&
result
.
started
,
1
)
}
}
func
stopServers
()
{
func
stopServers
()
{
...
@@ -494,19 +487,6 @@ func checkBloomFilterExchange(t *testing.T) {
...
@@ -494,19 +487,6 @@ func checkBloomFilterExchange(t *testing.T) {
}
}
}
}
func
waitForServersToStart
(
t
*
testing
.
T
)
{
const
iterations
=
200
var
started
int64
for
j
:=
0
;
j
<
iterations
;
j
++
{
time
.
Sleep
(
50
*
time
.
Millisecond
)
started
=
atomic
.
LoadInt64
(
&
result
.
started
)
if
started
==
NumNodes
{
return
}
}
t
.
Fatalf
(
"Failed to start all the servers, running: %d"
,
started
)
}
//two generic whisper node handshake
//two generic whisper node handshake
func
TestPeerHandshakeWithTwoFullNode
(
t
*
testing
.
T
)
{
func
TestPeerHandshakeWithTwoFullNode
(
t
*
testing
.
T
)
{
w1
:=
Whisper
{}
w1
:=
Whisper
{}
...
...
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