eth: golint fixes to variable names (#16711)
This commit is contained in:
		
							parent
							
								
									4ea493e7eb
								
							
						
					
					
						commit
						4747aad160
					
				| @ -37,26 +37,26 @@ import ( | |||||||
| 	"github.com/ethereum/go-ethereum/rpc" | 	"github.com/ethereum/go-ethereum/rpc" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| // EthApiBackend implements ethapi.Backend for full nodes
 | // EthAPIBackend implements ethapi.Backend for full nodes
 | ||||||
| type EthApiBackend struct { | type EthAPIBackend struct { | ||||||
| 	eth *Ethereum | 	eth *Ethereum | ||||||
| 	gpo *gasprice.Oracle | 	gpo *gasprice.Oracle | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (b *EthApiBackend) ChainConfig() *params.ChainConfig { | func (b *EthAPIBackend) ChainConfig() *params.ChainConfig { | ||||||
| 	return b.eth.chainConfig | 	return b.eth.chainConfig | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (b *EthApiBackend) CurrentBlock() *types.Block { | func (b *EthAPIBackend) CurrentBlock() *types.Block { | ||||||
| 	return b.eth.blockchain.CurrentBlock() | 	return b.eth.blockchain.CurrentBlock() | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (b *EthApiBackend) SetHead(number uint64) { | func (b *EthAPIBackend) SetHead(number uint64) { | ||||||
| 	b.eth.protocolManager.downloader.Cancel() | 	b.eth.protocolManager.downloader.Cancel() | ||||||
| 	b.eth.blockchain.SetHead(number) | 	b.eth.blockchain.SetHead(number) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (b *EthApiBackend) HeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Header, error) { | func (b *EthAPIBackend) HeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Header, error) { | ||||||
| 	// Pending block is only known by the miner
 | 	// Pending block is only known by the miner
 | ||||||
| 	if blockNr == rpc.PendingBlockNumber { | 	if blockNr == rpc.PendingBlockNumber { | ||||||
| 		block := b.eth.miner.PendingBlock() | 		block := b.eth.miner.PendingBlock() | ||||||
| @ -69,7 +69,7 @@ func (b *EthApiBackend) HeaderByNumber(ctx context.Context, blockNr rpc.BlockNum | |||||||
| 	return b.eth.blockchain.GetHeaderByNumber(uint64(blockNr)), nil | 	return b.eth.blockchain.GetHeaderByNumber(uint64(blockNr)), nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (b *EthApiBackend) BlockByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Block, error) { | func (b *EthAPIBackend) BlockByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Block, error) { | ||||||
| 	// Pending block is only known by the miner
 | 	// Pending block is only known by the miner
 | ||||||
| 	if blockNr == rpc.PendingBlockNumber { | 	if blockNr == rpc.PendingBlockNumber { | ||||||
| 		block := b.eth.miner.PendingBlock() | 		block := b.eth.miner.PendingBlock() | ||||||
| @ -82,7 +82,7 @@ func (b *EthApiBackend) BlockByNumber(ctx context.Context, blockNr rpc.BlockNumb | |||||||
| 	return b.eth.blockchain.GetBlockByNumber(uint64(blockNr)), nil | 	return b.eth.blockchain.GetBlockByNumber(uint64(blockNr)), nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (b *EthApiBackend) StateAndHeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*state.StateDB, *types.Header, error) { | func (b *EthAPIBackend) StateAndHeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*state.StateDB, *types.Header, error) { | ||||||
| 	// Pending state is only known by the miner
 | 	// Pending state is only known by the miner
 | ||||||
| 	if blockNr == rpc.PendingBlockNumber { | 	if blockNr == rpc.PendingBlockNumber { | ||||||
| 		block, state := b.eth.miner.Pending() | 		block, state := b.eth.miner.Pending() | ||||||
| @ -97,18 +97,18 @@ func (b *EthApiBackend) StateAndHeaderByNumber(ctx context.Context, blockNr rpc. | |||||||
| 	return stateDb, header, err | 	return stateDb, header, err | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (b *EthApiBackend) GetBlock(ctx context.Context, hash common.Hash) (*types.Block, error) { | func (b *EthAPIBackend) GetBlock(ctx context.Context, hash common.Hash) (*types.Block, error) { | ||||||
| 	return b.eth.blockchain.GetBlockByHash(hash), nil | 	return b.eth.blockchain.GetBlockByHash(hash), nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (b *EthApiBackend) GetReceipts(ctx context.Context, hash common.Hash) (types.Receipts, error) { | func (b *EthAPIBackend) GetReceipts(ctx context.Context, hash common.Hash) (types.Receipts, error) { | ||||||
| 	if number := rawdb.ReadHeaderNumber(b.eth.chainDb, hash); number != nil { | 	if number := rawdb.ReadHeaderNumber(b.eth.chainDb, hash); number != nil { | ||||||
| 		return rawdb.ReadReceipts(b.eth.chainDb, hash, *number), nil | 		return rawdb.ReadReceipts(b.eth.chainDb, hash, *number), nil | ||||||
| 	} | 	} | ||||||
| 	return nil, nil | 	return nil, nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (b *EthApiBackend) GetLogs(ctx context.Context, hash common.Hash) ([][]*types.Log, error) { | func (b *EthAPIBackend) GetLogs(ctx context.Context, hash common.Hash) ([][]*types.Log, error) { | ||||||
| 	number := rawdb.ReadHeaderNumber(b.eth.chainDb, hash) | 	number := rawdb.ReadHeaderNumber(b.eth.chainDb, hash) | ||||||
| 	if number == nil { | 	if number == nil { | ||||||
| 		return nil, nil | 		return nil, nil | ||||||
| @ -124,11 +124,11 @@ func (b *EthApiBackend) GetLogs(ctx context.Context, hash common.Hash) ([][]*typ | |||||||
| 	return logs, nil | 	return logs, nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (b *EthApiBackend) GetTd(blockHash common.Hash) *big.Int { | func (b *EthAPIBackend) GetTd(blockHash common.Hash) *big.Int { | ||||||
| 	return b.eth.blockchain.GetTdByHash(blockHash) | 	return b.eth.blockchain.GetTdByHash(blockHash) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (b *EthApiBackend) GetEVM(ctx context.Context, msg core.Message, state *state.StateDB, header *types.Header, vmCfg vm.Config) (*vm.EVM, func() error, error) { | func (b *EthAPIBackend) GetEVM(ctx context.Context, msg core.Message, state *state.StateDB, header *types.Header, vmCfg vm.Config) (*vm.EVM, func() error, error) { | ||||||
| 	state.SetBalance(msg.From(), math.MaxBig256) | 	state.SetBalance(msg.From(), math.MaxBig256) | ||||||
| 	vmError := func() error { return nil } | 	vmError := func() error { return nil } | ||||||
| 
 | 
 | ||||||
| @ -136,31 +136,31 @@ func (b *EthApiBackend) GetEVM(ctx context.Context, msg core.Message, state *sta | |||||||
| 	return vm.NewEVM(context, state, b.eth.chainConfig, vmCfg), vmError, nil | 	return vm.NewEVM(context, state, b.eth.chainConfig, vmCfg), vmError, nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (b *EthApiBackend) SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent) event.Subscription { | func (b *EthAPIBackend) SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent) event.Subscription { | ||||||
| 	return b.eth.BlockChain().SubscribeRemovedLogsEvent(ch) | 	return b.eth.BlockChain().SubscribeRemovedLogsEvent(ch) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (b *EthApiBackend) SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription { | func (b *EthAPIBackend) SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription { | ||||||
| 	return b.eth.BlockChain().SubscribeChainEvent(ch) | 	return b.eth.BlockChain().SubscribeChainEvent(ch) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (b *EthApiBackend) SubscribeChainHeadEvent(ch chan<- core.ChainHeadEvent) event.Subscription { | func (b *EthAPIBackend) SubscribeChainHeadEvent(ch chan<- core.ChainHeadEvent) event.Subscription { | ||||||
| 	return b.eth.BlockChain().SubscribeChainHeadEvent(ch) | 	return b.eth.BlockChain().SubscribeChainHeadEvent(ch) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (b *EthApiBackend) SubscribeChainSideEvent(ch chan<- core.ChainSideEvent) event.Subscription { | func (b *EthAPIBackend) SubscribeChainSideEvent(ch chan<- core.ChainSideEvent) event.Subscription { | ||||||
| 	return b.eth.BlockChain().SubscribeChainSideEvent(ch) | 	return b.eth.BlockChain().SubscribeChainSideEvent(ch) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (b *EthApiBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription { | func (b *EthAPIBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription { | ||||||
| 	return b.eth.BlockChain().SubscribeLogsEvent(ch) | 	return b.eth.BlockChain().SubscribeLogsEvent(ch) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (b *EthApiBackend) SendTx(ctx context.Context, signedTx *types.Transaction) error { | func (b *EthAPIBackend) SendTx(ctx context.Context, signedTx *types.Transaction) error { | ||||||
| 	return b.eth.txPool.AddLocal(signedTx) | 	return b.eth.txPool.AddLocal(signedTx) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (b *EthApiBackend) GetPoolTransactions() (types.Transactions, error) { | func (b *EthAPIBackend) GetPoolTransactions() (types.Transactions, error) { | ||||||
| 	pending, err := b.eth.txPool.Pending() | 	pending, err := b.eth.txPool.Pending() | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return nil, err | 		return nil, err | ||||||
| @ -172,56 +172,56 @@ func (b *EthApiBackend) GetPoolTransactions() (types.Transactions, error) { | |||||||
| 	return txs, nil | 	return txs, nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (b *EthApiBackend) GetPoolTransaction(hash common.Hash) *types.Transaction { | func (b *EthAPIBackend) GetPoolTransaction(hash common.Hash) *types.Transaction { | ||||||
| 	return b.eth.txPool.Get(hash) | 	return b.eth.txPool.Get(hash) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (b *EthApiBackend) GetPoolNonce(ctx context.Context, addr common.Address) (uint64, error) { | func (b *EthAPIBackend) GetPoolNonce(ctx context.Context, addr common.Address) (uint64, error) { | ||||||
| 	return b.eth.txPool.State().GetNonce(addr), nil | 	return b.eth.txPool.State().GetNonce(addr), nil | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (b *EthApiBackend) Stats() (pending int, queued int) { | func (b *EthAPIBackend) Stats() (pending int, queued int) { | ||||||
| 	return b.eth.txPool.Stats() | 	return b.eth.txPool.Stats() | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (b *EthApiBackend) TxPoolContent() (map[common.Address]types.Transactions, map[common.Address]types.Transactions) { | func (b *EthAPIBackend) TxPoolContent() (map[common.Address]types.Transactions, map[common.Address]types.Transactions) { | ||||||
| 	return b.eth.TxPool().Content() | 	return b.eth.TxPool().Content() | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (b *EthApiBackend) SubscribeTxPreEvent(ch chan<- core.TxPreEvent) event.Subscription { | func (b *EthAPIBackend) SubscribeTxPreEvent(ch chan<- core.TxPreEvent) event.Subscription { | ||||||
| 	return b.eth.TxPool().SubscribeTxPreEvent(ch) | 	return b.eth.TxPool().SubscribeTxPreEvent(ch) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (b *EthApiBackend) Downloader() *downloader.Downloader { | func (b *EthAPIBackend) Downloader() *downloader.Downloader { | ||||||
| 	return b.eth.Downloader() | 	return b.eth.Downloader() | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (b *EthApiBackend) ProtocolVersion() int { | func (b *EthAPIBackend) ProtocolVersion() int { | ||||||
| 	return b.eth.EthVersion() | 	return b.eth.EthVersion() | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (b *EthApiBackend) SuggestPrice(ctx context.Context) (*big.Int, error) { | func (b *EthAPIBackend) SuggestPrice(ctx context.Context) (*big.Int, error) { | ||||||
| 	return b.gpo.SuggestPrice(ctx) | 	return b.gpo.SuggestPrice(ctx) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (b *EthApiBackend) ChainDb() ethdb.Database { | func (b *EthAPIBackend) ChainDb() ethdb.Database { | ||||||
| 	return b.eth.ChainDb() | 	return b.eth.ChainDb() | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (b *EthApiBackend) EventMux() *event.TypeMux { | func (b *EthAPIBackend) EventMux() *event.TypeMux { | ||||||
| 	return b.eth.EventMux() | 	return b.eth.EventMux() | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (b *EthApiBackend) AccountManager() *accounts.Manager { | func (b *EthAPIBackend) AccountManager() *accounts.Manager { | ||||||
| 	return b.eth.AccountManager() | 	return b.eth.AccountManager() | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (b *EthApiBackend) BloomStatus() (uint64, uint64) { | func (b *EthAPIBackend) BloomStatus() (uint64, uint64) { | ||||||
| 	sections, _, _ := b.eth.bloomIndexer.Sections() | 	sections, _, _ := b.eth.bloomIndexer.Sections() | ||||||
| 	return params.BloomBitsBlocks, sections | 	return params.BloomBitsBlocks, sections | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| func (b *EthApiBackend) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession) { | func (b *EthAPIBackend) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession) { | ||||||
| 	for i := 0; i < bloomFilterThreads; i++ { | 	for i := 0; i < bloomFilterThreads; i++ { | ||||||
| 		go session.Multiplex(bloomRetrievalBatch, bloomRetrievalWait, b.eth.bloomRequests) | 		go session.Multiplex(bloomRetrievalBatch, bloomRetrievalWait, b.eth.bloomRequests) | ||||||
| 	} | 	} | ||||||
|  | |||||||
| @ -82,7 +82,7 @@ type Ethereum struct { | |||||||
| 	bloomRequests chan chan *bloombits.Retrieval // Channel receiving bloom data retrieval requests
 | 	bloomRequests chan chan *bloombits.Retrieval // Channel receiving bloom data retrieval requests
 | ||||||
| 	bloomIndexer  *core.ChainIndexer             // Bloom indexer operating during block imports
 | 	bloomIndexer  *core.ChainIndexer             // Bloom indexer operating during block imports
 | ||||||
| 
 | 
 | ||||||
| 	ApiBackend *EthApiBackend | 	APIBackend *EthAPIBackend | ||||||
| 
 | 
 | ||||||
| 	miner     *miner.Miner | 	miner     *miner.Miner | ||||||
| 	gasPrice  *big.Int | 	gasPrice  *big.Int | ||||||
| @ -169,12 +169,12 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) { | |||||||
| 	eth.miner = miner.New(eth, eth.chainConfig, eth.EventMux(), eth.engine) | 	eth.miner = miner.New(eth, eth.chainConfig, eth.EventMux(), eth.engine) | ||||||
| 	eth.miner.SetExtra(makeExtraData(config.ExtraData)) | 	eth.miner.SetExtra(makeExtraData(config.ExtraData)) | ||||||
| 
 | 
 | ||||||
| 	eth.ApiBackend = &EthApiBackend{eth, nil} | 	eth.APIBackend = &EthAPIBackend{eth, nil} | ||||||
| 	gpoParams := config.GPO | 	gpoParams := config.GPO | ||||||
| 	if gpoParams.Default == nil { | 	if gpoParams.Default == nil { | ||||||
| 		gpoParams.Default = config.GasPrice | 		gpoParams.Default = config.GasPrice | ||||||
| 	} | 	} | ||||||
| 	eth.ApiBackend.gpo = gasprice.NewOracle(eth.ApiBackend, gpoParams) | 	eth.APIBackend.gpo = gasprice.NewOracle(eth.APIBackend, gpoParams) | ||||||
| 
 | 
 | ||||||
| 	return eth, nil | 	return eth, nil | ||||||
| } | } | ||||||
| @ -242,7 +242,7 @@ func CreateConsensusEngine(ctx *node.ServiceContext, config *ethash.Config, chai | |||||||
| // APIs returns the collection of RPC services the ethereum package offers.
 | // APIs returns the collection of RPC services the ethereum package offers.
 | ||||||
| // NOTE, some of these services probably need to be moved to somewhere else.
 | // NOTE, some of these services probably need to be moved to somewhere else.
 | ||||||
| func (s *Ethereum) APIs() []rpc.API { | func (s *Ethereum) APIs() []rpc.API { | ||||||
| 	apis := ethapi.GetAPIs(s.ApiBackend) | 	apis := ethapi.GetAPIs(s.APIBackend) | ||||||
| 
 | 
 | ||||||
| 	// Append any APIs exposed explicitly by the consensus engine
 | 	// Append any APIs exposed explicitly by the consensus engine
 | ||||||
| 	apis = append(apis, s.engine.APIs(s.BlockChain())...) | 	apis = append(apis, s.engine.APIs(s.BlockChain())...) | ||||||
| @ -272,7 +272,7 @@ func (s *Ethereum) APIs() []rpc.API { | |||||||
| 		}, { | 		}, { | ||||||
| 			Namespace: "eth", | 			Namespace: "eth", | ||||||
| 			Version:   "1.0", | 			Version:   "1.0", | ||||||
| 			Service:   filters.NewPublicFilterAPI(s.ApiBackend, false), | 			Service:   filters.NewPublicFilterAPI(s.APIBackend, false), | ||||||
| 			Public:    true, | 			Public:    true, | ||||||
| 		}, { | 		}, { | ||||||
| 			Namespace: "admin", | 			Namespace: "admin", | ||||||
|  | |||||||
| @ -34,13 +34,13 @@ const ( | |||||||
| 	eth63 = 63 | 	eth63 = 63 | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| // Official short name of the protocol used during capability negotiation.
 | // ProtocolName is the official short name of the protocol used during capability negotiation.
 | ||||||
| var ProtocolName = "eth" | var ProtocolName = "eth" | ||||||
| 
 | 
 | ||||||
| // Supported versions of the eth protocol (first is primary).
 | // ProtocolVersions are the upported versions of the eth protocol (first is primary).
 | ||||||
| var ProtocolVersions = []uint{eth63, eth62} | var ProtocolVersions = []uint{eth63, eth62} | ||||||
| 
 | 
 | ||||||
| // Number of implemented message corresponding to different protocol versions.
 | // ProtocolLengths are the number of implemented message corresponding to different protocol versions.
 | ||||||
| var ProtocolLengths = []uint64{17, 8} | var ProtocolLengths = []uint64{17, 8} | ||||||
| 
 | 
 | ||||||
| const ProtocolMaxMsgSize = 10 * 1024 * 1024 // Maximum cap on the size of a protocol message
 | const ProtocolMaxMsgSize = 10 * 1024 * 1024 // Maximum cap on the size of a protocol message
 | ||||||
|  | |||||||
| @ -689,7 +689,7 @@ func (s *Service) reportStats(conn *websocket.Conn) error { | |||||||
| 		sync := s.eth.Downloader().Progress() | 		sync := s.eth.Downloader().Progress() | ||||||
| 		syncing = s.eth.BlockChain().CurrentHeader().Number.Uint64() >= sync.HighestBlock | 		syncing = s.eth.BlockChain().CurrentHeader().Number.Uint64() >= sync.HighestBlock | ||||||
| 
 | 
 | ||||||
| 		price, _ := s.eth.ApiBackend.SuggestPrice(context.Background()) | 		price, _ := s.eth.APIBackend.SuggestPrice(context.Background()) | ||||||
| 		gasprice = int(price.Uint64()) | 		gasprice = int(price.Uint64()) | ||||||
| 	} else { | 	} else { | ||||||
| 		sync := s.les.Downloader().Progress() | 		sync := s.les.Downloader().Progress() | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user