forked from cerc-io/plugeth
Merge pull request #14922 from egonelbre/megacheck_miner
miner: fix megacheck warnings
This commit is contained in:
commit
8c2cf3c66c
@ -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
|
// RemoteAgent.Start() constantly recreates these channels, so the loop code cannot
|
||||||
// assume data stability in these member fields.
|
// assume data stability in these member fields.
|
||||||
func (a *RemoteAgent) loop(workCh chan *Work, quitCh chan struct{}) {
|
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 {
|
for {
|
||||||
select {
|
select {
|
||||||
@ -179,7 +180,7 @@ func (a *RemoteAgent) loop(workCh chan *Work, quitCh chan struct{}) {
|
|||||||
a.mu.Lock()
|
a.mu.Lock()
|
||||||
a.currentWork = work
|
a.currentWork = work
|
||||||
a.mu.Unlock()
|
a.mu.Unlock()
|
||||||
case <-ticker:
|
case <-ticker.C:
|
||||||
// cleanup
|
// cleanup
|
||||||
a.mu.Lock()
|
a.mu.Lock()
|
||||||
for hash, work := range a.work {
|
for hash, work := range a.work {
|
||||||
|
@ -24,7 +24,6 @@ import (
|
|||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/accounts"
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/consensus"
|
"github.com/ethereum/go-ethereum/consensus"
|
||||||
"github.com/ethereum/go-ethereum/consensus/misc"
|
"github.com/ethereum/go-ethereum/consensus/misc"
|
||||||
@ -109,9 +108,6 @@ type worker struct {
|
|||||||
uncleMu sync.Mutex
|
uncleMu sync.Mutex
|
||||||
possibleUncles map[common.Hash]*types.Block
|
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
|
unconfirmed *unconfirmedBlocks // set of locally mined blocks pending canonicalness confirmations
|
||||||
|
|
||||||
// atomic status counters
|
// atomic status counters
|
||||||
@ -133,9 +129,8 @@ func newWorker(config *params.ChainConfig, engine consensus.Engine, coinbase com
|
|||||||
proc: eth.BlockChain().Validator(),
|
proc: eth.BlockChain().Validator(),
|
||||||
possibleUncles: make(map[common.Hash]*types.Block),
|
possibleUncles: make(map[common.Hash]*types.Block),
|
||||||
coinbase: coinbase,
|
coinbase: coinbase,
|
||||||
txQueue: make(map[common.Hash]*types.Transaction),
|
|
||||||
agents: make(map[Agent]struct{}),
|
agents: make(map[Agent]struct{}),
|
||||||
unconfirmed: newUnconfirmedBlocks(eth.BlockChain(), 5),
|
unconfirmed: newUnconfirmedBlocks(eth.BlockChain(), miningLogAtDepth),
|
||||||
fullValidation: false,
|
fullValidation: false,
|
||||||
}
|
}
|
||||||
worker.events = worker.mux.Subscribe(core.ChainHeadEvent{}, core.ChainSideEvent{}, core.TxPreEvent{})
|
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.family.Add(ancestor.Hash())
|
||||||
work.ancestors.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
|
// Keep track of transactions which return errors so they can be removed
|
||||||
work.tcount = 0
|
work.tcount = 0
|
||||||
self.current = work
|
self.current = work
|
||||||
|
Loading…
Reference in New Issue
Block a user