From 6505abf73dfe51673a0e564cc5d6f2b6c04d692f Mon Sep 17 00:00:00 2001 From: Kiel barry Date: Tue, 1 May 2018 09:42:24 -0700 Subject: [PATCH 1/2] eth/*:golint updates for this or self warning --- eth/backend.go | 12 ++++++------ eth/handler.go | 30 +++++++++++++++--------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/eth/backend.go b/eth/backend.go index ffd5d854212a..425301b5b6c5 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -325,13 +325,13 @@ func (s *Ethereum) Etherbase() (eb common.Address, err error) { return common.Address{}, fmt.Errorf("etherbase must be explicitly specified") } -// set in js console via admin interface or wrapper from cli flags -func (self *Ethereum) SetEtherbase(etherbase common.Address) { - self.lock.Lock() - self.etherbase = etherbase - self.lock.Unlock() +// SetEtherbase in js console via admin interface or wrapper from cli flags +func (s *Ethereum) SetEtherbase(etherbase common.Address) { + s.lock.Lock() + s.etherbase = etherbase + s.lock.Unlock() - self.miner.SetEtherbase(etherbase) + s.miner.SetEtherbase(etherbase) } func (s *Ethereum) StartMining(local bool) error { diff --git a/eth/handler.go b/eth/handler.go index 4069359c9ecd..2eee483ce967 100644 --- a/eth/handler.go +++ b/eth/handler.go @@ -725,25 +725,25 @@ func (pm *ProtocolManager) BroadcastTx(hash common.Hash, tx *types.Transaction) } // Mined broadcast loop -func (self *ProtocolManager) minedBroadcastLoop() { +func (pm *ProtocolManager) minedBroadcastLoop() { // automatically stops if unsubscribe - for obj := range self.minedBlockSub.Chan() { + for obj := range pm.minedBlockSub.Chan() { switch ev := obj.Data.(type) { case core.NewMinedBlockEvent: - self.BroadcastBlock(ev.Block, true) // First propagate block to peers - self.BroadcastBlock(ev.Block, false) // Only then announce to the rest + pm.BroadcastBlock(ev.Block, true) // First propagate block to peers + pm.BroadcastBlock(ev.Block, false) // Only then announce to the rest } } } -func (self *ProtocolManager) txBroadcastLoop() { +func (pm *ProtocolManager) txBroadcastLoop() { for { select { - case event := <-self.txCh: - self.BroadcastTx(event.Tx.Hash(), event.Tx) + case event := <-pm.txCh: + pm.BroadcastTx(event.Tx.Hash(), event.Tx) // Err() channel will be closed when unsubscribing. - case <-self.txSub.Err(): + case <-pm.txSub.Err(): return } } @@ -760,13 +760,13 @@ type NodeInfo struct { } // NodeInfo retrieves some protocol metadata about the running host node. -func (self *ProtocolManager) NodeInfo() *NodeInfo { - currentBlock := self.blockchain.CurrentBlock() +func (pm *ProtocolManager) NodeInfo() *NodeInfo { + currentBlock := pm.blockchain.CurrentBlock() return &NodeInfo{ - Network: self.networkId, - Difficulty: self.blockchain.GetTd(currentBlock.Hash(), currentBlock.NumberU64()), - Genesis: self.blockchain.Genesis().Hash(), - Config: self.blockchain.Config(), + Network: pm.networkId, + Difficulty: pm.blockchain.GetTd(currentBlock.Hash(), currentBlock.NumberU64()), + Genesis: pm.blockchain.Genesis().Hash(), + Config: pm.blockchain.Config(), Head: currentBlock.Hash(), } -} +} \ No newline at end of file From 5e3c68eabcbec694a52705975d6b5b169bfdbd2c Mon Sep 17 00:00:00 2001 From: Kiel barry Date: Tue, 1 May 2018 09:42:24 -0700 Subject: [PATCH 2/2] eth/*: golint updates for this or self warning, pr updated per feedback --- eth/backend.go | 2 +- eth/handler.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/eth/backend.go b/eth/backend.go index 425301b5b6c5..a26ccd044aaf 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -325,7 +325,7 @@ func (s *Ethereum) Etherbase() (eb common.Address, err error) { return common.Address{}, fmt.Errorf("etherbase must be explicitly specified") } -// SetEtherbase in js console via admin interface or wrapper from cli flags +// SetEtherbase sets the mining reward address. func (s *Ethereum) SetEtherbase(etherbase common.Address) { s.lock.Lock() s.etherbase = etherbase diff --git a/eth/handler.go b/eth/handler.go index 2eee483ce967..c8f7e13f16e9 100644 --- a/eth/handler.go +++ b/eth/handler.go @@ -769,4 +769,4 @@ func (pm *ProtocolManager) NodeInfo() *NodeInfo { Config: pm.blockchain.Config(), Head: currentBlock.Hash(), } -} \ No newline at end of file +}