Skip to content

Commit a470038

Browse files
committed
eth: golint fixes to variable names (ethereum#16711)
1 parent d31bc9a commit a470038

File tree

4 files changed

+42
-42
lines changed

4 files changed

+42
-42
lines changed

eth/api_backend.go

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -37,26 +37,26 @@ import (
3737
"github.com/ethereum/go-ethereum/rpc"
3838
)
3939

40-
// EthApiBackend implements ethapi.Backend for full nodes
41-
type EthApiBackend struct {
40+
// EthAPIBackend implements ethapi.Backend for full nodes
41+
type EthAPIBackend struct {
4242
eth *Ethereum
4343
gpo *gasprice.Oracle
4444
}
4545

46-
func (b *EthApiBackend) ChainConfig() *params.ChainConfig {
46+
func (b *EthAPIBackend) ChainConfig() *params.ChainConfig {
4747
return b.eth.chainConfig
4848
}
4949

50-
func (b *EthApiBackend) CurrentBlock() *types.Block {
50+
func (b *EthAPIBackend) CurrentBlock() *types.Block {
5151
return b.eth.blockchain.CurrentBlock()
5252
}
5353

54-
func (b *EthApiBackend) SetHead(number uint64) {
54+
func (b *EthAPIBackend) SetHead(number uint64) {
5555
b.eth.protocolManager.downloader.Cancel()
5656
b.eth.blockchain.SetHead(number)
5757
}
5858

59-
func (b *EthApiBackend) HeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Header, error) {
59+
func (b *EthAPIBackend) HeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Header, error) {
6060
// Pending block is only known by the miner
6161
if blockNr == rpc.PendingBlockNumber {
6262
block := b.eth.miner.PendingBlock()
@@ -69,7 +69,7 @@ func (b *EthApiBackend) HeaderByNumber(ctx context.Context, blockNr rpc.BlockNum
6969
return b.eth.blockchain.GetHeaderByNumber(uint64(blockNr)), nil
7070
}
7171

72-
func (b *EthApiBackend) BlockByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Block, error) {
72+
func (b *EthAPIBackend) BlockByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Block, error) {
7373
// Pending block is only known by the miner
7474
if blockNr == rpc.PendingBlockNumber {
7575
block := b.eth.miner.PendingBlock()
@@ -82,7 +82,7 @@ func (b *EthApiBackend) BlockByNumber(ctx context.Context, blockNr rpc.BlockNumb
8282
return b.eth.blockchain.GetBlockByNumber(uint64(blockNr)), nil
8383
}
8484

85-
func (b *EthApiBackend) StateAndHeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*state.StateDB, *types.Header, error) {
85+
func (b *EthAPIBackend) StateAndHeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*state.StateDB, *types.Header, error) {
8686
// Pending state is only known by the miner
8787
if blockNr == rpc.PendingBlockNumber {
8888
block, state := b.eth.miner.Pending()
@@ -97,18 +97,18 @@ func (b *EthApiBackend) StateAndHeaderByNumber(ctx context.Context, blockNr rpc.
9797
return stateDb, header, err
9898
}
9999

100-
func (b *EthApiBackend) GetBlock(ctx context.Context, hash common.Hash) (*types.Block, error) {
100+
func (b *EthAPIBackend) GetBlock(ctx context.Context, hash common.Hash) (*types.Block, error) {
101101
return b.eth.blockchain.GetBlockByHash(hash), nil
102102
}
103103

104-
func (b *EthApiBackend) GetReceipts(ctx context.Context, hash common.Hash) (types.Receipts, error) {
104+
func (b *EthAPIBackend) GetReceipts(ctx context.Context, hash common.Hash) (types.Receipts, error) {
105105
if number := rawdb.ReadHeaderNumber(b.eth.chainDb, hash); number != nil {
106106
return rawdb.ReadReceipts(b.eth.chainDb, hash, *number), nil
107107
}
108108
return nil, nil
109109
}
110110

111-
func (b *EthApiBackend) GetLogs(ctx context.Context, hash common.Hash) ([][]*types.Log, error) {
111+
func (b *EthAPIBackend) GetLogs(ctx context.Context, hash common.Hash) ([][]*types.Log, error) {
112112
number := rawdb.ReadHeaderNumber(b.eth.chainDb, hash)
113113
if number == nil {
114114
return nil, nil
@@ -124,43 +124,43 @@ func (b *EthApiBackend) GetLogs(ctx context.Context, hash common.Hash) ([][]*typ
124124
return logs, nil
125125
}
126126

127-
func (b *EthApiBackend) GetTd(blockHash common.Hash) *big.Int {
127+
func (b *EthAPIBackend) GetTd(blockHash common.Hash) *big.Int {
128128
return b.eth.blockchain.GetTdByHash(blockHash)
129129
}
130130

131-
func (b *EthApiBackend) GetEVM(ctx context.Context, msg core.Message, state *state.StateDB, header *types.Header, vmCfg vm.Config) (*vm.EVM, func() error, error) {
131+
func (b *EthAPIBackend) GetEVM(ctx context.Context, msg core.Message, state *state.StateDB, header *types.Header, vmCfg vm.Config) (*vm.EVM, func() error, error) {
132132
state.SetBalance(msg.From(), math.MaxBig256)
133133
vmError := func() error { return nil }
134134

135135
context := core.NewEVMContext(msg, header, b.eth.BlockChain(), nil)
136136
return vm.NewEVM(context, state, b.eth.chainConfig, vmCfg), vmError, nil
137137
}
138138

139-
func (b *EthApiBackend) SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent) event.Subscription {
139+
func (b *EthAPIBackend) SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent) event.Subscription {
140140
return b.eth.BlockChain().SubscribeRemovedLogsEvent(ch)
141141
}
142142

143-
func (b *EthApiBackend) SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription {
143+
func (b *EthAPIBackend) SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription {
144144
return b.eth.BlockChain().SubscribeChainEvent(ch)
145145
}
146146

147-
func (b *EthApiBackend) SubscribeChainHeadEvent(ch chan<- core.ChainHeadEvent) event.Subscription {
147+
func (b *EthAPIBackend) SubscribeChainHeadEvent(ch chan<- core.ChainHeadEvent) event.Subscription {
148148
return b.eth.BlockChain().SubscribeChainHeadEvent(ch)
149149
}
150150

151-
func (b *EthApiBackend) SubscribeChainSideEvent(ch chan<- core.ChainSideEvent) event.Subscription {
151+
func (b *EthAPIBackend) SubscribeChainSideEvent(ch chan<- core.ChainSideEvent) event.Subscription {
152152
return b.eth.BlockChain().SubscribeChainSideEvent(ch)
153153
}
154154

155-
func (b *EthApiBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription {
155+
func (b *EthAPIBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription {
156156
return b.eth.BlockChain().SubscribeLogsEvent(ch)
157157
}
158158

159-
func (b *EthApiBackend) SendTx(ctx context.Context, signedTx *types.Transaction) error {
159+
func (b *EthAPIBackend) SendTx(ctx context.Context, signedTx *types.Transaction) error {
160160
return b.eth.txPool.AddLocal(signedTx)
161161
}
162162

163-
func (b *EthApiBackend) GetPoolTransactions() (types.Transactions, error) {
163+
func (b *EthAPIBackend) GetPoolTransactions() (types.Transactions, error) {
164164
pending, err := b.eth.txPool.Pending()
165165
if err != nil {
166166
return nil, err
@@ -172,56 +172,56 @@ func (b *EthApiBackend) GetPoolTransactions() (types.Transactions, error) {
172172
return txs, nil
173173
}
174174

175-
func (b *EthApiBackend) GetPoolTransaction(hash common.Hash) *types.Transaction {
175+
func (b *EthAPIBackend) GetPoolTransaction(hash common.Hash) *types.Transaction {
176176
return b.eth.txPool.Get(hash)
177177
}
178178

179-
func (b *EthApiBackend) GetPoolNonce(ctx context.Context, addr common.Address) (uint64, error) {
179+
func (b *EthAPIBackend) GetPoolNonce(ctx context.Context, addr common.Address) (uint64, error) {
180180
return b.eth.txPool.State().GetNonce(addr), nil
181181
}
182182

183-
func (b *EthApiBackend) Stats() (pending int, queued int) {
183+
func (b *EthAPIBackend) Stats() (pending int, queued int) {
184184
return b.eth.txPool.Stats()
185185
}
186186

187-
func (b *EthApiBackend) TxPoolContent() (map[common.Address]types.Transactions, map[common.Address]types.Transactions) {
187+
func (b *EthAPIBackend) TxPoolContent() (map[common.Address]types.Transactions, map[common.Address]types.Transactions) {
188188
return b.eth.TxPool().Content()
189189
}
190190

191-
func (b *EthApiBackend) SubscribeTxPreEvent(ch chan<- core.TxPreEvent) event.Subscription {
191+
func (b *EthAPIBackend) SubscribeTxPreEvent(ch chan<- core.TxPreEvent) event.Subscription {
192192
return b.eth.TxPool().SubscribeTxPreEvent(ch)
193193
}
194194

195-
func (b *EthApiBackend) Downloader() *downloader.Downloader {
195+
func (b *EthAPIBackend) Downloader() *downloader.Downloader {
196196
return b.eth.Downloader()
197197
}
198198

199-
func (b *EthApiBackend) ProtocolVersion() int {
199+
func (b *EthAPIBackend) ProtocolVersion() int {
200200
return b.eth.EthVersion()
201201
}
202202

203-
func (b *EthApiBackend) SuggestPrice(ctx context.Context) (*big.Int, error) {
203+
func (b *EthAPIBackend) SuggestPrice(ctx context.Context) (*big.Int, error) {
204204
return b.gpo.SuggestPrice(ctx)
205205
}
206206

207-
func (b *EthApiBackend) ChainDb() ethdb.Database {
207+
func (b *EthAPIBackend) ChainDb() ethdb.Database {
208208
return b.eth.ChainDb()
209209
}
210210

211-
func (b *EthApiBackend) EventMux() *event.TypeMux {
211+
func (b *EthAPIBackend) EventMux() *event.TypeMux {
212212
return b.eth.EventMux()
213213
}
214214

215-
func (b *EthApiBackend) AccountManager() *accounts.Manager {
215+
func (b *EthAPIBackend) AccountManager() *accounts.Manager {
216216
return b.eth.AccountManager()
217217
}
218218

219-
func (b *EthApiBackend) BloomStatus() (uint64, uint64) {
219+
func (b *EthAPIBackend) BloomStatus() (uint64, uint64) {
220220
sections, _, _ := b.eth.bloomIndexer.Sections()
221221
return params.BloomBitsBlocks, sections
222222
}
223223

224-
func (b *EthApiBackend) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession) {
224+
func (b *EthAPIBackend) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession) {
225225
for i := 0; i < bloomFilterThreads; i++ {
226226
go session.Multiplex(bloomRetrievalBatch, bloomRetrievalWait, b.eth.bloomRequests)
227227
}

eth/backend.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ type Ethereum struct {
8282
bloomRequests chan chan *bloombits.Retrieval // Channel receiving bloom data retrieval requests
8383
bloomIndexer *core.ChainIndexer // Bloom indexer operating during block imports
8484

85-
ApiBackend *EthApiBackend
85+
APIBackend *EthAPIBackend
8686

8787
miner *miner.Miner
8888
gasPrice *big.Int
@@ -169,12 +169,12 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
169169
eth.miner = miner.New(eth, eth.chainConfig, eth.EventMux(), eth.engine)
170170
eth.miner.SetExtra(makeExtraData(config.ExtraData))
171171

172-
eth.ApiBackend = &EthApiBackend{eth, nil}
172+
eth.APIBackend = &EthAPIBackend{eth, nil}
173173
gpoParams := config.GPO
174174
if gpoParams.Default == nil {
175175
gpoParams.Default = config.GasPrice
176176
}
177-
eth.ApiBackend.gpo = gasprice.NewOracle(eth.ApiBackend, gpoParams)
177+
eth.APIBackend.gpo = gasprice.NewOracle(eth.APIBackend, gpoParams)
178178

179179
return eth, nil
180180
}
@@ -242,7 +242,7 @@ func CreateConsensusEngine(ctx *node.ServiceContext, config *ethash.Config, chai
242242
// APIs returns the collection of RPC services the ethereum package offers.
243243
// NOTE, some of these services probably need to be moved to somewhere else.
244244
func (s *Ethereum) APIs() []rpc.API {
245-
apis := ethapi.GetAPIs(s.ApiBackend)
245+
apis := ethapi.GetAPIs(s.APIBackend)
246246

247247
// Append any APIs exposed explicitly by the consensus engine
248248
apis = append(apis, s.engine.APIs(s.BlockChain())...)
@@ -272,7 +272,7 @@ func (s *Ethereum) APIs() []rpc.API {
272272
}, {
273273
Namespace: "eth",
274274
Version: "1.0",
275-
Service: filters.NewPublicFilterAPI(s.ApiBackend, false),
275+
Service: filters.NewPublicFilterAPI(s.APIBackend, false),
276276
Public: true,
277277
}, {
278278
Namespace: "admin",

eth/protocol.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ const (
3434
eth63 = 63
3535
)
3636

37-
// Official short name of the protocol used during capability negotiation.
37+
// ProtocolName is the official short name of the protocol used during capability negotiation.
3838
var ProtocolName = "eth"
3939

40-
// Supported versions of the eth protocol (first is primary).
40+
// ProtocolVersions are the upported versions of the eth protocol (first is primary).
4141
var ProtocolVersions = []uint{eth63, eth62}
4242

43-
// Number of implemented message corresponding to different protocol versions.
43+
// ProtocolLengths are the number of implemented message corresponding to different protocol versions.
4444
var ProtocolLengths = []uint64{17, 8}
4545

4646
const ProtocolMaxMsgSize = 10 * 1024 * 1024 // Maximum cap on the size of a protocol message

ethstats/ethstats.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ func (s *Service) reportStats(conn *websocket.Conn) error {
689689
sync := s.eth.Downloader().Progress()
690690
syncing = s.eth.BlockChain().CurrentHeader().Number.Uint64() >= sync.HighestBlock
691691

692-
price, _ := s.eth.ApiBackend.SuggestPrice(context.Background())
692+
price, _ := s.eth.APIBackend.SuggestPrice(context.Background())
693693
gasprice = int(price.Uint64())
694694
} else {
695695
sync := s.les.Downloader().Progress()

0 commit comments

Comments
 (0)