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
5d91accc
Commit
5d91accc
authored
Oct 30, 2019
by
gary rong
Committed by
Felix Lange
Oct 30, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
miner: increase import time allowance (#20217)
Fix the block import unit test which can time out sometimes.
parent
9641cace
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
worker_test.go
miner/worker_test.go
+7
-5
No files found.
miner/worker_test.go
View file @
5d91accc
...
...
@@ -84,6 +84,7 @@ func init() {
pendingTxs
=
append
(
pendingTxs
,
tx1
)
tx2
,
_
:=
types
.
SignTx
(
types
.
NewTransaction
(
1
,
testUserAddress
,
big
.
NewInt
(
1000
),
params
.
TxGas
,
nil
,
nil
),
types
.
HomesteadSigner
{},
testBankKey
)
newTxs
=
append
(
newTxs
,
tx2
)
rand
.
Seed
(
time
.
Now
()
.
UnixNano
())
}
// testWorkerBackend implements worker.Backend interfaces and wraps all information needed during the testing.
...
...
@@ -159,9 +160,9 @@ func (b *testWorkerBackend) newRandomUncle() *types.Block {
parent
=
b
.
chain
.
GetBlockByHash
(
b
.
chain
.
CurrentBlock
()
.
ParentHash
())
}
blocks
,
_
:=
core
.
GenerateChain
(
b
.
chain
.
Config
(),
parent
,
b
.
chain
.
Engine
(),
b
.
db
,
1
,
func
(
i
int
,
gen
*
core
.
BlockGen
)
{
var
addr
common
.
Address
rand
.
Read
(
addr
.
Bytes
()
)
gen
.
SetCoinbase
(
addr
)
var
addr
=
make
([]
byte
,
common
.
AddressLength
)
rand
.
Read
(
addr
)
gen
.
SetCoinbase
(
common
.
BytesToAddress
(
addr
)
)
})
return
blocks
[
0
]
}
...
...
@@ -200,6 +201,7 @@ func testGenerateBlockAndImport(t *testing.T, isClique bool) {
)
if
isClique
{
chainConfig
=
params
.
AllCliqueProtocolChanges
chainConfig
.
Clique
=
&
params
.
CliqueConfig
{
Period
:
1
,
Epoch
:
30000
}
engine
=
clique
.
New
(
chainConfig
.
Clique
,
db
)
}
else
{
chainConfig
=
params
.
AllEthashProtocolChanges
...
...
@@ -254,14 +256,14 @@ func testGenerateBlockAndImport(t *testing.T, isClique bool) {
w
.
skipSealHook
=
func
(
task
*
task
)
bool
{
return
len
(
task
.
receipts
)
==
0
}
for
i
:=
0
;
i
<
5
0
;
i
++
{
for
i
:=
0
;
i
<
5
;
i
++
{
b
.
txPool
.
AddLocal
(
b
.
newRandomTx
(
true
))
b
.
txPool
.
AddLocal
(
b
.
newRandomTx
(
false
))
b
.
PostChainEvents
([]
interface
{}{
core
.
ChainSideEvent
{
Block
:
b
.
newRandomUncle
()}})
b
.
PostChainEvents
([]
interface
{}{
core
.
ChainSideEvent
{
Block
:
b
.
newRandomUncle
()}})
select
{
case
<-
newBlock
:
case
<-
time
.
NewTimer
(
time
.
Millisecond
*
1500
)
.
C
:
// Worker needs 1s to include new changes.
case
<-
time
.
NewTimer
(
3
*
time
.
Second
)
.
C
:
// Worker needs 1s to include new changes.
t
.
Fatalf
(
"timeout"
)
}
}
...
...
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