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
4eb01b21
Unverified
Commit
4eb01b21
authored
Oct 14, 2020
by
Martin Holst Swende
Committed by
GitHub
Oct 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
miner: set etherbase even if mining isn't possible at the moment (#21707)
parent
bdc75549
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
1 deletion
+23
-1
miner.go
miner/miner.go
+1
-1
miner_test.go
miner/miner_test.go
+22
-0
No files found.
miner/miner.go
View file @
4eb01b21
...
@@ -128,8 +128,8 @@ func (miner *Miner) update() {
...
@@ -128,8 +128,8 @@ func (miner *Miner) update() {
events
.
Unsubscribe
()
events
.
Unsubscribe
()
}
}
case
addr
:=
<-
miner
.
startCh
:
case
addr
:=
<-
miner
.
startCh
:
miner
.
SetEtherbase
(
addr
)
if
canStart
{
if
canStart
{
miner
.
SetEtherbase
(
addr
)
miner
.
worker
.
start
()
miner
.
worker
.
start
()
}
}
shouldStart
=
true
shouldStart
=
true
...
...
miner/miner_test.go
View file @
4eb01b21
...
@@ -192,6 +192,28 @@ func TestCloseMiner(t *testing.T) {
...
@@ -192,6 +192,28 @@ func TestCloseMiner(t *testing.T) {
waitForMiningState
(
t
,
miner
,
false
)
waitForMiningState
(
t
,
miner
,
false
)
}
}
// TestMinerSetEtherbase checks that etherbase becomes set even if mining isn't
// possible at the moment
func
TestMinerSetEtherbase
(
t
*
testing
.
T
)
{
miner
,
mux
:=
createMiner
(
t
)
// Start with a 'bad' mining address
miner
.
Start
(
common
.
HexToAddress
(
"0xdead"
))
waitForMiningState
(
t
,
miner
,
true
)
// Start the downloader
mux
.
Post
(
downloader
.
StartEvent
{})
waitForMiningState
(
t
,
miner
,
false
)
// Now user tries to configure proper mining address
miner
.
Start
(
common
.
HexToAddress
(
"0x1337"
))
// Stop the downloader and wait for the update loop to run
mux
.
Post
(
downloader
.
DoneEvent
{})
waitForMiningState
(
t
,
miner
,
true
)
// The miner should now be using the good address
if
got
,
exp
:=
miner
.
coinbase
,
common
.
HexToAddress
(
"0x1337"
);
got
!=
exp
{
t
.
Fatalf
(
"Wrong coinbase, got %x expected %x"
,
got
,
exp
)
}
}
// waitForMiningState waits until either
// waitForMiningState waits until either
// * the desired mining state was reached
// * the desired mining state was reached
// * a timeout was reached which fails the test
// * a timeout was reached which fails the test
...
...
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