Skip to content

Commit

Permalink
eth,internal/ethapi: sync comments with previous renamings
Browse files Browse the repository at this point in the history
  • Loading branch information
lightclient committed Jun 21, 2022
1 parent 52b782d commit 0030c7e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 29 deletions.
20 changes: 8 additions & 12 deletions eth/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ import (
"github.com/ethereum/go-ethereum/trie"
)

// EthereumAPI provides an API to access Ethereum full node-related
// information.
// EthereumAPI provides an API to access Ethereum full node-related information.
type EthereumAPI struct {
e *Ethereum
}
Expand Down Expand Up @@ -73,12 +72,11 @@ func (api *EthereumAPI) Mining() bool {
}

// MinerAPI provides an API to control the miner.
// It offers only methods that operate on data that pose no security risk when it is publicly accessible.
type MinerAPI struct {
e *Ethereum
}

// NewMinerAPI create a new PublicMinerAPI instance.
// NewMinerAPI create a new MinerAPI instance.
func NewMinerAPI(e *Ethereum) *MinerAPI {
return &MinerAPI{e}
}
Expand Down Expand Up @@ -136,14 +134,13 @@ func (api *MinerAPI) SetRecommitInterval(interval int) {
api.e.Miner().SetRecommitInterval(time.Duration(interval) * time.Millisecond)
}

// AdminAPI is the collection of Ethereum full node-related APIs
// exposed over the private admin endpoint.
// AdminAPI is the collection of Ethereum full node related APIs for node
// administration.
type AdminAPI struct {
eth *Ethereum
}

// NewAdminAPI creates a new API definition for the full node private
// admin methods of the Ethereum service.
// NewAdminAPI creates a new instance of AdminAPI.
func NewAdminAPI(eth *Ethereum) *AdminAPI {
return &AdminAPI{eth: eth}
}
Expand Down Expand Up @@ -246,14 +243,13 @@ func (api *AdminAPI) ImportChain(file string) (bool, error) {
return true, nil
}

// DebugAPI is the collection of Ethereum full node APIs exposed
// over the public debugging endpoint.
// DebugAPI is the collection of Ethereum full node APIs for debugging the
// protocol.
type DebugAPI struct {
eth *Ethereum
}

// NewDebugAPI creates a new API definition for the full node-
// related public debug methods of the Ethereum service.
// NewDebugAPI creates a new DebugAPI instance.
func NewDebugAPI(eth *Ethereum) *DebugAPI {
return &DebugAPI{eth: eth}
}
Expand Down
2 changes: 1 addition & 1 deletion eth/downloader/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type DownloaderAPI struct {
uninstallSyncSubscription chan *uninstallSyncSubscriptionRequest
}

// NewDownloaderAPI create a new PublicDownloaderAPI. The API has an internal event loop that
// NewDownloaderAPI create a new DownloaderAPI. The API has an internal event loop that
// listens for events from the downloader through the global event mux. In case it receives one of
// these events it broadcasts it to all syncing subscriptions that are installed through the
// installSyncSubscription channel.
Expand Down
2 changes: 1 addition & 1 deletion eth/filters/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type FilterAPI struct {
timeout time.Duration
}

// NewFilterAPI returns a new PublicFilterAPI instance.
// NewFilterAPI returns a new FilterAPI instance.
func NewFilterAPI(backend Backend, lightMode bool, timeout time.Duration) *FilterAPI {
api := &FilterAPI{
backend: backend,
Expand Down
27 changes: 12 additions & 15 deletions internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ import (
)

// EthereumAPI provides an API to access Ethereum related information.
// It offers only methods that operate on public data that is freely available to anyone.
type EthereumAPI struct {
b Backend
}
Expand Down Expand Up @@ -258,12 +257,12 @@ type EthereumAccountAPI struct {
am *accounts.Manager
}

// NewEthereumAccountAPI creates a new PublicAccountAPI.
// NewEthereumAccountAPI creates a new EthereumAccountAPI.
func NewEthereumAccountAPI(am *accounts.Manager) *EthereumAccountAPI {
return &EthereumAccountAPI{am: am}
}

// Accounts returns the collection of accounts this node manages
// Accounts returns the collection of accounts this node manages.
func (s *EthereumAccountAPI) Accounts() []common.Address {
return s.am.Accounts()
}
Expand All @@ -277,7 +276,7 @@ type PersonalAccountAPI struct {
b Backend
}

// NewPersonalAccountAPI create a new PrivateAccountAPI.
// NewPersonalAccountAPI create a new PersonalAccountAPI.
func NewPersonalAccountAPI(b Backend, nonceLock *AddrLocker) *PersonalAccountAPI {
return &PersonalAccountAPI{
am: b.AccountManager(),
Expand Down Expand Up @@ -599,8 +598,7 @@ func (s *PersonalAccountAPI) Unpair(ctx context.Context, url string, pin string)
}
}

// BlockChainAPI provides an API to access the Ethereum blockchain.
// It offers only methods that operate on public data that is freely available to anyone.
// BlockChainAPI provides an API to access Ethereum blockchain data.
type BlockChainAPI struct {
b Backend
}
Expand All @@ -610,7 +608,7 @@ func NewBlockChainAPI(b Backend) *BlockChainAPI {
return &BlockChainAPI{b}
}

// ChainId is the EIP-155 replay-protection chain id for the current ethereum chain config.
// ChainId is the EIP-155 replay-protection chain id for the current Ethereum chain config.
func (api *BlockChainAPI) ChainId() (*hexutil.Big, error) {
// if current block is at or past the EIP-155 replay-protection fork block, return chainID from config
if config := api.b.ChainConfig(); config.IsEIP155(api.b.CurrentBlock().Number()) {
Expand Down Expand Up @@ -1216,15 +1214,15 @@ func RPCMarshalBlock(block *types.Block, inclTx bool, fullTx bool, config *param
}

// rpcMarshalHeader uses the generalized output filler, then adds the total difficulty field, which requires
// a `PublicBlockchainAPI`.
// a `BlockchainAPI`.
func (s *BlockChainAPI) rpcMarshalHeader(ctx context.Context, header *types.Header) map[string]interface{} {
fields := RPCMarshalHeader(header)
fields["totalDifficulty"] = (*hexutil.Big)(s.b.GetTd(ctx, header.Hash()))
return fields
}

// rpcMarshalBlock uses the generalized output filler, then adds the total difficulty field, which requires
// a `PublicBlockchainAPI`.
// a `BlockchainAPI`.
func (s *BlockChainAPI) rpcMarshalBlock(ctx context.Context, b *types.Block, inclTx bool, fullTx bool) (map[string]interface{}, error) {
fields, err := RPCMarshalBlock(b, inclTx, fullTx, s.b.ChainConfig())
if err != nil {
Expand Down Expand Up @@ -1447,14 +1445,14 @@ func AccessList(ctx context.Context, b Backend, blockNrOrHash rpc.BlockNumberOrH
}
}

// TransactionAPI exposes methods for the RPC interface
// TransactionAPI exposes methods for reading and creating transaction data.
type TransactionAPI struct {
b Backend
nonceLock *AddrLocker
signer types.Signer
}

// NewTransactionAPI creates a new RPC service with methods specific for the transaction pool.
// NewTransactionAPI creates a new RPC service with methods for interacting with transactions.
func NewTransactionAPI(b Backend, nonceLock *AddrLocker) *TransactionAPI {
// The signer used by the API should always be the 'latest' known one because we expect
// signers to be backwards-compatible with old transactions.
Expand Down Expand Up @@ -1875,14 +1873,13 @@ func (s *TransactionAPI) Resend(ctx context.Context, sendArgs TransactionArgs, g
return common.Hash{}, fmt.Errorf("transaction %#x not found", matchTx.Hash())
}

// DebugAPI is the collection of Ethereum APIs exposed over the public
// debugging endpoint.
// DebugAPI is the collection of Ethereum APIs exposed over the debugging
// namespace.
type DebugAPI struct {
b Backend
}

// NewDebugAPI creates a new API definition for the public debug methods
// of the Ethereum service.
// NewDebugAPI creates a new instance of DebugAPI.
func NewDebugAPI(b Backend) *DebugAPI {
return &DebugAPI{b: b}
}
Expand Down

0 comments on commit 0030c7e

Please sign in to comment.