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
29379032
Commit
29379032
authored
Jun 11, 2015
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth/downloader: remove uneeded testing functions
parent
66d3dc86
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
37 deletions
+2
-37
downloader_test.go
eth/downloader/downloader_test.go
+2
-7
queue_test.go
eth/downloader/queue_test.go
+0
-30
No files found.
eth/downloader/downloader_test.go
View file @
29379032
...
@@ -214,18 +214,13 @@ func TestBlockTaking(t *testing.T) {
...
@@ -214,18 +214,13 @@ func TestBlockTaking(t *testing.T) {
// Tests that an inactive downloader will not accept incoming hashes and blocks.
// Tests that an inactive downloader will not accept incoming hashes and blocks.
func
TestInactiveDownloader
(
t
*
testing
.
T
)
{
func
TestInactiveDownloader
(
t
*
testing
.
T
)
{
// Create a small enough block chain to download and the tester
targetBlocks
:=
blockCacheLimit
-
15
hashes
:=
createHashes
(
0
,
targetBlocks
)
blocks
:=
createBlocksFromHashSet
(
createHashSet
(
hashes
))
tester
:=
newTester
(
t
,
nil
,
nil
)
tester
:=
newTester
(
t
,
nil
,
nil
)
// Check that neither hashes nor blocks are accepted
// Check that neither hashes nor blocks are accepted
if
err
:=
tester
.
downloader
.
DeliverHashes
(
"bad peer"
,
hashes
);
err
!=
errNoSyncActive
{
if
err
:=
tester
.
downloader
.
DeliverHashes
(
"bad peer"
,
[]
common
.
Hash
{}
);
err
!=
errNoSyncActive
{
t
.
Errorf
(
"error mismatch: have %v, want %v"
,
err
,
errNoSyncActive
)
t
.
Errorf
(
"error mismatch: have %v, want %v"
,
err
,
errNoSyncActive
)
}
}
if
err
:=
tester
.
downloader
.
DeliverBlocks
(
"bad peer"
,
blocks
);
err
!=
errNoSyncActive
{
if
err
:=
tester
.
downloader
.
DeliverBlocks
(
"bad peer"
,
[]
*
types
.
Block
{}
);
err
!=
errNoSyncActive
{
t
.
Errorf
(
"error mismatch: have %v, want %v"
,
err
,
errNoSyncActive
)
t
.
Errorf
(
"error mismatch: have %v, want %v"
,
err
,
errNoSyncActive
)
}
}
}
}
...
...
eth/downloader/queue_test.go
deleted
100644 → 0
View file @
66d3dc86
package
downloader
import
(
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"gopkg.in/fatih/set.v0"
)
func
createHashSet
(
hashes
[]
common
.
Hash
)
*
set
.
Set
{
hset
:=
set
.
New
()
for
_
,
hash
:=
range
hashes
{
hset
.
Add
(
hash
)
}
return
hset
}
func
createBlocksFromHashSet
(
hashes
*
set
.
Set
)
[]
*
types
.
Block
{
blocks
:=
make
([]
*
types
.
Block
,
hashes
.
Size
())
var
i
int
hashes
.
Each
(
func
(
v
interface
{})
bool
{
blocks
[
i
]
=
createBlock
(
i
,
common
.
Hash
{},
v
.
(
common
.
Hash
))
i
++
return
true
})
return
blocks
}
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