mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
internal/ethapi: golint fixes
This commit is contained in:
parent
0a049eeb00
commit
f5cf260309
3 changed files with 14 additions and 9 deletions
|
|
@ -22,6 +22,7 @@ import (
|
|||
"github.com/ethereum/go-ethereum/common"
|
||||
)
|
||||
|
||||
// AddrLocker is a stuct with the mutex and locks map
|
||||
type AddrLocker struct {
|
||||
mu sync.Mutex
|
||||
locks map[common.Address]*sync.Mutex
|
||||
|
|
|
|||
|
|
@ -212,14 +212,14 @@ func NewPrivateAccountAPI(b Backend, nonceLock *AddrLocker) *PrivateAccountAPI {
|
|||
}
|
||||
}
|
||||
|
||||
// listAccounts will return a list of addresses for accounts this node manages.
|
||||
// ListAccounts will return a list of addresses for accounts this node manages.
|
||||
func (s *PrivateAccountAPI) ListAccounts() []common.Address {
|
||||
return s.am.Accounts()
|
||||
}
|
||||
|
||||
// rawWallet is a JSON representation of an accounts.Wallet interface, with its
|
||||
// RawWallet is a JSON representation of an accounts.Wallet interface, with its
|
||||
// data contents extracted into plain fields.
|
||||
type rawWallet struct {
|
||||
type RawWallet struct {
|
||||
URL string `json:"url"`
|
||||
Status string `json:"status"`
|
||||
Failure string `json:"failure,omitempty"`
|
||||
|
|
@ -227,12 +227,12 @@ type rawWallet struct {
|
|||
}
|
||||
|
||||
// ListWallets will return a list of wallets this node manages.
|
||||
func (s *PrivateAccountAPI) ListWallets() []rawWallet {
|
||||
wallets := make([]rawWallet, 0) // return [] instead of nil if empty
|
||||
func (s *PrivateAccountAPI) ListWallets() []RawWallet {
|
||||
wallets := make([]RawWallet, 0) // return [] instead of nil if empty
|
||||
for _, wallet := range s.am.Wallets() {
|
||||
status, failure := wallet.Status()
|
||||
|
||||
raw := rawWallet{
|
||||
raw := RawWallet{
|
||||
URL: wallet.URL().String(),
|
||||
Status: status,
|
||||
Accounts: wallet.Accounts(),
|
||||
|
|
@ -516,8 +516,8 @@ func NewPublicBlockChainAPI(b Backend) *PublicBlockChainAPI {
|
|||
return &PublicBlockChainAPI{b}
|
||||
}
|
||||
|
||||
// ChainId returns the chainID value for transaction replay protection.
|
||||
func (s *PublicBlockChainAPI) ChainId() *hexutil.Big {
|
||||
// ChainID returns the chainID value for transaction replay protection.
|
||||
func (s *PublicBlockChainAPI) ChainID() *hexutil.Big {
|
||||
return (*hexutil.Big)(s.b.ChainConfig().ChainID)
|
||||
}
|
||||
|
||||
|
|
@ -538,7 +538,7 @@ func (s *PublicBlockChainAPI) GetBalance(ctx context.Context, address common.Add
|
|||
return (*hexutil.Big)(state.GetBalance(address)), state.Error()
|
||||
}
|
||||
|
||||
// Result structs for GetProof
|
||||
// AccountResult is a struct for GetProof
|
||||
type AccountResult struct {
|
||||
Address common.Address `json:"address"`
|
||||
AccountProof []string `json:"accountProof"`
|
||||
|
|
@ -548,6 +548,7 @@ type AccountResult struct {
|
|||
StorageHash common.Hash `json:"storageHash"`
|
||||
StorageProof []StorageResult `json:"storageProof"`
|
||||
}
|
||||
// StorageResult is a struct for storing proofs
|
||||
type StorageResult struct {
|
||||
Key string `json:"key"`
|
||||
Value *hexutil.Big `json:"value"`
|
||||
|
|
@ -757,6 +758,7 @@ type account struct {
|
|||
StateDiff *map[common.Hash]common.Hash `json:"stateDiff"`
|
||||
}
|
||||
|
||||
// DoCall will execute an EVM call
|
||||
func DoCall(ctx context.Context, b Backend, args CallArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides map[common.Address]account, vmCfg vm.Config, timeout time.Duration, globalGasCap *big.Int) ([]byte, uint64, bool, error) {
|
||||
defer func(start time.Time) { log.Debug("Executing EVM call finished", "runtime", time.Since(start)) }(time.Now())
|
||||
|
||||
|
|
@ -883,6 +885,7 @@ func (s *PublicBlockChainAPI) Call(ctx context.Context, args CallArgs, blockNrOr
|
|||
return (hexutil.Bytes)(result), err
|
||||
}
|
||||
|
||||
// DoEstimateGas will estimate the gas
|
||||
func DoEstimateGas(ctx context.Context, b Backend, args CallArgs, blockNrOrHash rpc.BlockNumberOrHash, gasCap *big.Int) (hexutil.Uint64, error) {
|
||||
// Binary search the gas requirement, as it may be higher than the amount used
|
||||
var (
|
||||
|
|
|
|||
|
|
@ -86,6 +86,7 @@ type Backend interface {
|
|||
CurrentBlock() *types.Block
|
||||
}
|
||||
|
||||
// GetAPIs will return a map of the APIs
|
||||
func GetAPIs(apiBackend Backend) []rpc.API {
|
||||
nonceLock := new(AddrLocker)
|
||||
return []rpc.API{
|
||||
|
|
|
|||
Loading…
Reference in a new issue