good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
13c25036
Commit
13c25036
authored
Jun 18, 2015
by
Péter Szilágyi
Browse files
Options
Downloads
Patches
Plain Diff
eth/fetcher: since uncles are allowed, drop phase test
parent
ecd19919
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
eth/fetcher/fetcher_test.go
+0
-51
0 additions, 51 deletions
eth/fetcher/fetcher_test.go
with
0 additions
and
51 deletions
eth/fetcher/fetcher_test.go
+
0
−
51
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
))
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment