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
13c25036
Commit
13c25036
authored
Jun 18, 2015
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth/fetcher: since uncles are allowed, drop phase test
parent
ecd19919
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
51 deletions
+0
-51
fetcher_test.go
eth/fetcher/fetcher_test.go
+0
-51
No files found.
eth/fetcher/fetcher_test.go
View file @
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
))
}
}
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