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
6e713710
Unverified
Commit
6e713710
authored
Oct 20, 2020
by
Marius van der Wijden
Committed by
GitHub
Oct 20, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
miner: fixed race condition in tests (#21664)
parent
cef3e2dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
15 deletions
+8
-15
miner_test.go
miner/miner_test.go
+8
-15
No files found.
miner/miner_test.go
View file @
6e713710
...
...
@@ -22,7 +22,7 @@ import (
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/consensus/
ethash
"
"github.com/ethereum/go-ethereum/consensus/
clique
"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/rawdb"
"github.com/ethereum/go-ethereum/core/state"
...
...
@@ -31,7 +31,6 @@ import (
"github.com/ethereum/go-ethereum/eth/downloader"
"github.com/ethereum/go-ethereum/ethdb/memorydb"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/trie"
)
...
...
@@ -243,26 +242,20 @@ func createMiner(t *testing.T) (*Miner, *event.TypeMux) {
if
err
!=
nil
{
t
.
Fatalf
(
"can't create new chain config: %v"
,
err
)
}
// Create event Mux
mux
:=
new
(
event
.
TypeMux
)
// Create consensus engine
engine
:=
ethash
.
New
(
ethash
.
Config
{},
[]
string
{},
false
)
engine
.
SetThreads
(
-
1
)
// Create isLocalBlock
isLocalBlock
:=
func
(
block
*
types
.
Block
)
bool
{
return
true
}
engine
:=
clique
.
New
(
chainConfig
.
Clique
,
chainDB
)
// Create Ethereum backend
limit
:=
uint64
(
1000
)
bc
,
err
:=
core
.
NewBlockChain
(
chainDB
,
new
(
core
.
CacheConfig
),
chainConfig
,
engine
,
vm
.
Config
{},
isLocalBlock
,
&
limit
)
bc
,
err
:=
core
.
NewBlockChain
(
chainDB
,
nil
,
chainConfig
,
engine
,
vm
.
Config
{},
nil
,
nil
)
if
err
!=
nil
{
t
.
Fatalf
(
"can't create new chain %v"
,
err
)
}
statedb
,
_
:=
state
.
New
(
common
.
Hash
{},
state
.
NewDatabase
(
rawdb
.
NewMemoryDatabase
()
),
nil
)
statedb
,
_
:=
state
.
New
(
common
.
Hash
{},
state
.
NewDatabase
(
chainDB
),
nil
)
blockchain
:=
&
testBlockChain
{
statedb
,
10000000
,
new
(
event
.
Feed
)}
pool
:=
core
.
NewTxPool
(
testTxPoolConfig
,
params
.
TestC
hainConfig
,
blockchain
)
pool
:=
core
.
NewTxPool
(
testTxPoolConfig
,
c
hainConfig
,
blockchain
)
backend
:=
NewMockBackend
(
bc
,
pool
)
// Create event Mux
mux
:=
new
(
event
.
TypeMux
)
// Create Miner
return
New
(
backend
,
&
config
,
chainConfig
,
mux
,
engine
,
isLocalBlock
),
mux
return
New
(
backend
,
&
config
,
chainConfig
,
mux
,
engine
,
nil
),
mux
}
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