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
d09d2b96
Commit
d09d2b96
authored
Apr 07, 2015
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed stop of miner
parent
7f32a08b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
14 deletions
+12
-14
worker.go
miner/worker.go
+12
-14
No files found.
miner/worker.go
View file @
d09d2b96
...
...
@@ -98,12 +98,11 @@ func newWorker(coinbase common.Address, eth core.Backend) *worker {
possibleUncles
:
make
(
map
[
common
.
Hash
]
*
types
.
Block
),
coinbase
:
coinbase
,
txQueue
:
make
(
map
[
common
.
Hash
]
*
types
.
Transaction
),
quit
:
make
(
chan
struct
{}),
}
go
worker
.
update
()
go
worker
.
wait
()
worker
.
quit
=
make
(
chan
struct
{})
worker
.
commitNewWork
()
return
worker
...
...
@@ -133,8 +132,14 @@ func (self *worker) start() {
}
func
(
self
*
worker
)
stop
()
{
atomic
.
StoreInt64
(
&
self
.
mining
,
0
)
if
atomic
.
LoadInt64
(
&
self
.
mining
)
==
1
{
// stop all agents
for
_
,
agent
:=
range
self
.
agents
{
agent
.
Stop
()
}
}
atomic
.
StoreInt64
(
&
self
.
mining
,
0
)
atomic
.
StoreInt64
(
&
self
.
atWork
,
0
)
}
...
...
@@ -164,12 +169,7 @@ out:
self
.
commitNewWork
()
}
}
case
<-
self
.
quit
:
// stop all agents
for
_
,
agent
:=
range
self
.
agents
{
agent
.
Stop
()
}
break
out
case
<-
timer
.
C
:
if
glog
.
V
(
logger
.
Debug
)
{
...
...
@@ -261,20 +261,18 @@ func (self *worker) commitNewWork() {
// Keep track of transactions which return errors so they can be removed
var
(
remove
types
.
Transactions
remove
=
set
.
New
()
tcount
=
0
)
gasLimit
:
for
i
,
tx
:=
range
transactions
{
err
:=
self
.
commitTransaction
(
tx
)
switch
{
case
core
.
IsNonceErr
(
err
)
:
fallthrough
case
core
.
IsInvalidTxErr
(
err
)
:
case
core
.
IsNonceErr
(
err
)
||
core
.
IsInvalidTxErr
(
err
)
:
// Remove invalid transactions
from
,
_
:=
tx
.
From
()
self
.
chain
.
TxState
()
.
RemoveNonce
(
from
,
tx
.
Nonce
())
remove
=
append
(
remove
,
tx
)
remove
.
Add
(
tx
.
Hash
()
)
if
glog
.
V
(
logger
.
Debug
)
{
glog
.
Infof
(
"TX (%x) failed, will be removed: %v
\n
"
,
tx
.
Hash
()
.
Bytes
()[
:
4
],
err
)
...
...
@@ -288,7 +286,7 @@ gasLimit:
tcount
++
}
}
self
.
eth
.
TxPool
()
.
Remov
eSet
(
remove
)
self
.
eth
.
TxPool
()
.
Invalidat
eSet
(
remove
)
var
(
uncles
[]
*
types
.
Header
...
...
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