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
30293497
Commit
30293497
authored
Jul 20, 2015
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
miner: fix current work data race
parent
02c50227
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
worker.go
miner/worker.go
+3
-2
No files found.
miner/worker.go
View file @
30293497
...
@@ -160,6 +160,7 @@ func (self *worker) pendingState() *state.StateDB {
...
@@ -160,6 +160,7 @@ func (self *worker) pendingState() *state.StateDB {
func
(
self
*
worker
)
pendingBlock
()
*
types
.
Block
{
func
(
self
*
worker
)
pendingBlock
()
*
types
.
Block
{
self
.
currentMu
.
Lock
()
self
.
currentMu
.
Lock
()
defer
self
.
currentMu
.
Unlock
()
defer
self
.
currentMu
.
Unlock
()
if
atomic
.
LoadInt32
(
&
self
.
mining
)
==
0
{
if
atomic
.
LoadInt32
(
&
self
.
mining
)
==
0
{
return
types
.
NewBlock
(
return
types
.
NewBlock
(
self
.
current
.
header
,
self
.
current
.
header
,
...
@@ -228,9 +229,9 @@ out:
...
@@ -228,9 +229,9 @@ out:
case
core
.
TxPreEvent
:
case
core
.
TxPreEvent
:
// Apply transaction to the pending state if we're not mining
// Apply transaction to the pending state if we're not mining
if
atomic
.
LoadInt32
(
&
self
.
mining
)
==
0
{
if
atomic
.
LoadInt32
(
&
self
.
mining
)
==
0
{
self
.
m
u
.
Lock
()
self
.
currentM
u
.
Lock
()
self
.
current
.
commitTransactions
(
types
.
Transactions
{
ev
.
Tx
},
self
.
gasPrice
,
self
.
proc
)
self
.
current
.
commitTransactions
(
types
.
Transactions
{
ev
.
Tx
},
self
.
gasPrice
,
self
.
proc
)
self
.
m
u
.
Unlock
()
self
.
currentM
u
.
Unlock
()
}
}
}
}
case
<-
self
.
quit
:
case
<-
self
.
quit
:
...
...
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