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
faafeef7
Commit
faafeef7
authored
Aug 06, 2017
by
Egon Elbre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
miner: fix megacheck warnings
parent
b159cdd8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
13 deletions
+5
-13
remote_agent.go
miner/remote_agent.go
+3
-2
worker.go
miner/worker.go
+2
-11
No files found.
miner/remote_agent.go
View file @
faafeef7
...
...
@@ -169,7 +169,8 @@ func (a *RemoteAgent) SubmitWork(nonce types.BlockNonce, mixDigest, hash common.
// RemoteAgent.Start() constantly recreates these channels, so the loop code cannot
// assume data stability in these member fields.
func
(
a
*
RemoteAgent
)
loop
(
workCh
chan
*
Work
,
quitCh
chan
struct
{})
{
ticker
:=
time
.
Tick
(
5
*
time
.
Second
)
ticker
:=
time
.
NewTicker
(
5
*
time
.
Second
)
defer
ticker
.
Stop
()
for
{
select
{
...
...
@@ -179,7 +180,7 @@ func (a *RemoteAgent) loop(workCh chan *Work, quitCh chan struct{}) {
a
.
mu
.
Lock
()
a
.
currentWork
=
work
a
.
mu
.
Unlock
()
case
<-
ticker
:
case
<-
ticker
.
C
:
// cleanup
a
.
mu
.
Lock
()
for
hash
,
work
:=
range
a
.
work
{
...
...
miner/worker.go
View file @
faafeef7
...
...
@@ -24,7 +24,6 @@ import (
"sync/atomic"
"time"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/consensus"
"github.com/ethereum/go-ethereum/consensus/misc"
...
...
@@ -109,9 +108,6 @@ type worker struct {
uncleMu
sync
.
Mutex
possibleUncles
map
[
common
.
Hash
]
*
types
.
Block
txQueueMu
sync
.
Mutex
txQueue
map
[
common
.
Hash
]
*
types
.
Transaction
unconfirmed
*
unconfirmedBlocks
// set of locally mined blocks pending canonicalness confirmations
// atomic status counters
...
...
@@ -133,9 +129,8 @@ func newWorker(config *params.ChainConfig, engine consensus.Engine, coinbase com
proc
:
eth
.
BlockChain
()
.
Validator
(),
possibleUncles
:
make
(
map
[
common
.
Hash
]
*
types
.
Block
),
coinbase
:
coinbase
,
txQueue
:
make
(
map
[
common
.
Hash
]
*
types
.
Transaction
),
agents
:
make
(
map
[
Agent
]
struct
{}),
unconfirmed
:
newUnconfirmedBlocks
(
eth
.
BlockChain
(),
5
),
unconfirmed
:
newUnconfirmedBlocks
(
eth
.
BlockChain
(),
miningLogAtDepth
),
fullValidation
:
false
,
}
worker
.
events
=
worker
.
mux
.
Subscribe
(
core
.
ChainHeadEvent
{},
core
.
ChainSideEvent
{},
core
.
TxPreEvent
{})
...
...
@@ -362,11 +357,7 @@ func (self *worker) makeCurrent(parent *types.Block, header *types.Header) error
work
.
family
.
Add
(
ancestor
.
Hash
())
work
.
ancestors
.
Add
(
ancestor
.
Hash
())
}
wallets
:=
self
.
eth
.
AccountManager
()
.
Wallets
()
accounts
:=
make
([]
accounts
.
Account
,
0
,
len
(
wallets
))
for
_
,
wallet
:=
range
wallets
{
accounts
=
append
(
accounts
,
wallet
.
Accounts
()
...
)
}
// Keep track of transactions which return errors so they can be removed
work
.
tcount
=
0
self
.
current
=
work
...
...
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