mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
Correcting documentation format
This commit is contained in:
parent
3712581a00
commit
b9b5e40834
6 changed files with 33 additions and 50 deletions
|
|
@ -225,7 +225,6 @@ func (b *ClientBackend) ChainDb() ethdb.Database {
|
|||
return b.eth.chainDb
|
||||
}
|
||||
|
||||
// EventMux ...
|
||||
func (b *ClientBackend) EventMux() *event.TypeMux {
|
||||
return b.eth.eventMux
|
||||
}
|
||||
|
|
@ -240,12 +239,14 @@ func (b *ClientBackend) ExtRPCEnabled() bool {
|
|||
return b.extRPCEnabled
|
||||
}
|
||||
|
||||
// RPCGasCap - return the global gas cap for eth_call over rpc (DoS protection)
|
||||
// RPCGasCap return the global gas cap for eth_call over rpc (DoS protection)
|
||||
func (b *ClientBackend) RPCGasCap() *big.Int {
|
||||
return b.eth.config.RPCGasCap
|
||||
}
|
||||
|
||||
// BloomStatus ..
|
||||
// BloomStatus returns the number of BloomBitsBlocksClient (the number of blocks a single bloom bit section vector
|
||||
// contains on the light client side) and sections, (which is the number of processed sections maintained by the indexer
|
||||
// and also the information about the last header indexed for potential canonical verifications).
|
||||
func (b *ClientBackend) BloomStatus() (uint64, uint64) {
|
||||
if b.eth.bloomIndexer == nil {
|
||||
return 0, 0
|
||||
|
|
@ -254,7 +255,6 @@ func (b *ClientBackend) BloomStatus() (uint64, uint64) {
|
|||
return params.BloomBitsBlocksClient, sections
|
||||
}
|
||||
|
||||
// ServiceFilter ...
|
||||
func (b *ClientBackend) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession) {
|
||||
for i := 0; i < bloomFilterThreads; i++ {
|
||||
go session.Multiplex(bloomRetrievalBatch, bloomRetrievalWait, b.eth.bloomRequests)
|
||||
|
|
|
|||
|
|
@ -49,21 +49,21 @@ const (
|
|||
|
||||
ethVersion = 63 // equivalent eth version for the downloader
|
||||
|
||||
// MaxHeaderFetch - Amount of block headers to be fetched per retrieval request
|
||||
// MaxHeaderFetch is the maximum number of block headers to be fetched per retrieval request
|
||||
MaxHeaderFetch = 192
|
||||
// MaxBodyFetch - Amount of block bodies to be fetched per retrieval request
|
||||
// MaxBodyFetch is the maximum number of block bodies to be fetched per retrieval request
|
||||
MaxBodyFetch = 32
|
||||
// MaxReceiptFetch - Amount of transaction receipts to allow fetching per request
|
||||
// MaxReceiptFetch is the maximum number of transaction receipts to allow to be fetched per request
|
||||
MaxReceiptFetch = 128
|
||||
// MaxCodeFetch - Amount of contract codes to allow fetching per request
|
||||
// MaxCodeFetch is the maximum number of contract codes to allow to be fetched per request
|
||||
MaxCodeFetch = 64
|
||||
// MaxProofsFetch - Amount of merkle proofs to be fetched per retrieval request
|
||||
// MaxProofsFetch is the maximum number of merkle proofs to be fetched per retrieval request
|
||||
MaxProofsFetch = 64
|
||||
// MaxHelperTrieProofsFetch - Amount of merkle proofs to be fetched per retrieval request
|
||||
// MaxHelperTrieProofsFetch is the maximum number of merkle proofs to be fetched per retrieval request
|
||||
MaxHelperTrieProofsFetch = 64
|
||||
// MaxTxSend - Amount of transactions to be send per request
|
||||
// MaxTxSend is the maximum number of transactions to be sent per request
|
||||
MaxTxSend = 64
|
||||
// MaxTxStatus - Amount of transactions to queried per request
|
||||
// MaxTxStatus is the maximum number of transactions to queried per request
|
||||
MaxTxStatus = 256
|
||||
|
||||
disableClientRemovePeer = false
|
||||
|
|
@ -73,7 +73,7 @@ func errResp(code errCode, format string, v ...interface{}) error {
|
|||
return fmt.Errorf("%v - %v", code, fmt.Sprintf(format, v...))
|
||||
}
|
||||
|
||||
// BlockChain - a blockchain
|
||||
// BlockChain represents a blockchain, offering functions to query and maintain it
|
||||
type BlockChain interface {
|
||||
Config() *params.ChainConfig
|
||||
HasHeader(hash common.Hash, number uint64) bool
|
||||
|
|
|
|||
12
les/odr.go
12
les/odr.go
|
|
@ -82,17 +82,17 @@ func (odr *LesOdr) IndexerConfig() *light.IndexerConfig {
|
|||
}
|
||||
|
||||
const (
|
||||
// MsgBlockBodies - block bodies request
|
||||
// MsgBlockBodies represents a block bodies request
|
||||
MsgBlockBodies = iota
|
||||
// MsgCode - code request
|
||||
// MsgCode represents a code request
|
||||
MsgCode
|
||||
// MsgReceipts - receipts request
|
||||
// MsgReceipts represents a receipts request
|
||||
MsgReceipts
|
||||
// MsgProofsV2 - proofs request
|
||||
// MsgProofsV2 represents a v2 proofs request
|
||||
MsgProofsV2
|
||||
// MsgHelperTrieProofs - helper trie proofs request
|
||||
// MsgHelperTrieProofs represents a helper trie proofs request
|
||||
MsgHelperTrieProofs
|
||||
// MsgTxStatus - transaction status request
|
||||
// MsgTxStatus represents a transaction status request
|
||||
MsgTxStatus
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ var (
|
|||
errUselessNodes = errors.New("useless nodes in merkle proof nodeset")
|
||||
)
|
||||
|
||||
// LesOdrRequest - an on-demand request
|
||||
// LesOdrRequest represents an on-demand request from a client
|
||||
type LesOdrRequest interface {
|
||||
GetCost(*peer) uint64
|
||||
CanSend(*peer) bool
|
||||
|
|
@ -53,7 +53,7 @@ type LesOdrRequest interface {
|
|||
Validate(ethdb.Database, *Msg) error
|
||||
}
|
||||
|
||||
// LesRequest - generate a LES on demand request from a light one
|
||||
// LesRequest generates a LES on demand request based on an on-demand request from the 'light' namespace
|
||||
func LesRequest(req light.OdrRequest) LesOdrRequest {
|
||||
switch r := req.(type) {
|
||||
case *light.BlockRequest:
|
||||
|
|
@ -180,14 +180,14 @@ func (r *ReceiptsRequest) Validate(db ethdb.Database, msg *Msg) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// ProofReq - a request for a proof
|
||||
// ProofReq is a message requesting a proof
|
||||
type ProofReq struct {
|
||||
BHash common.Hash
|
||||
AccKey, Key []byte
|
||||
FromLevel uint
|
||||
}
|
||||
|
||||
// TrieRequest - ODR request type for state/storage trie entries, see LesOdrRequest interface
|
||||
// TrieRequest is an ODR request message for state/storage trie entries, see LesOdrRequest interface
|
||||
type TrieRequest light.TrieRequest
|
||||
|
||||
// GetCost returns the cost of the given ODR request according to the serving
|
||||
|
|
@ -236,13 +236,13 @@ func (r *TrieRequest) Validate(db ethdb.Database, msg *Msg) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// CodeReq - a request for contract code
|
||||
// CodeReq a request for contract code
|
||||
type CodeReq struct {
|
||||
BHash common.Hash
|
||||
AccKey []byte
|
||||
}
|
||||
|
||||
// CodeRequest - ODR request type for node data (used for retrieving contract code), see LesOdrRequest interface
|
||||
// CodeRequest is an ODR request type for code (used for retrieving contract code)
|
||||
type CodeRequest light.CodeRequest
|
||||
|
||||
// GetCost returns the cost of the given ODR request according to the serving
|
||||
|
|
@ -301,7 +301,7 @@ const (
|
|||
auxHeader = 2
|
||||
)
|
||||
|
||||
// HelperTrieReq - a request for part of a trie
|
||||
// HelperTrieReq is a request for part of a trie
|
||||
type HelperTrieReq struct {
|
||||
Type uint
|
||||
TrieIdx uint64
|
||||
|
|
@ -309,13 +309,13 @@ type HelperTrieReq struct {
|
|||
FromLevel, AuxReq uint
|
||||
}
|
||||
|
||||
// HelperTrieResps - response to HelperTrieReq, providing merkle proofs
|
||||
// HelperTrieResps response to HelperTrieReq, providing merkle proofs
|
||||
type HelperTrieResps struct { // describes all responses, not just a single one
|
||||
Proofs light.NodeList
|
||||
AuxData [][]byte
|
||||
}
|
||||
|
||||
// ChtRequest - ODR request type for requesting headers by Canonical Hash Trie, see LesOdrRequest interface
|
||||
// ChtRequest is an ODR request type for requesting headers by Canonical Hash Trie
|
||||
type ChtRequest light.ChtRequest
|
||||
|
||||
// GetCost returns the cost of the given ODR request according to the serving
|
||||
|
|
@ -399,12 +399,10 @@ func (r *ChtRequest) Validate(db ethdb.Database, msg *Msg) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// BloomReq -
|
||||
type BloomReq struct {
|
||||
BloomTrieNum, BitIdx, SectionIndex, FromLevel uint64
|
||||
}
|
||||
|
||||
// BloomRequest - ODR request type for requesting headers by Canonical Hash Trie, see LesOdrRequest interface
|
||||
type BloomRequest light.BloomRequest
|
||||
|
||||
// GetCost returns the cost of the given ODR request according to the serving
|
||||
|
|
|
|||
|
|
@ -93,35 +93,20 @@ var requests = map[uint64]requestInfo{
|
|||
type errCode int
|
||||
|
||||
const (
|
||||
// ErrMsgTooLarge - message too large
|
||||
ErrMsgTooLarge = iota
|
||||
// ErrDecode - decode error
|
||||
ErrDecode
|
||||
// ErrInvalidMsgCode - invalid message error
|
||||
ErrInvalidMsgCode
|
||||
// ErrProtocolVersionMismatch - mismatched protocol version
|
||||
ErrProtocolVersionMismatch
|
||||
// ErrNetworkIDMismatch - wrong network id
|
||||
ErrNetworkIDMismatch
|
||||
// ErrGenesisBlockMismatch - incompatible genesis blocks
|
||||
ErrGenesisBlockMismatch
|
||||
// ErrNoStatusMsg -
|
||||
ErrNoStatusMsg
|
||||
// ErrExtraStatusMsg -
|
||||
ErrExtraStatusMsg
|
||||
// ErrSuspendedPeer -
|
||||
ErrSuspendedPeer
|
||||
// ErrUselessPeer -
|
||||
ErrUselessPeer
|
||||
// ErrRequestRejected -
|
||||
ErrRequestRejected
|
||||
// ErrUnexpectedResponse -
|
||||
ErrUnexpectedResponse
|
||||
// ErrInvalidResponse -
|
||||
ErrInvalidResponse
|
||||
// ErrTooManyTimeouts -
|
||||
ErrTooManyTimeouts
|
||||
// ErrMissingKey -
|
||||
ErrMissingKey
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import (
|
|||
|
||||
const bufLimitRatio = 6000 // fixed bufLimit/MRR ratio
|
||||
|
||||
// LesServer - a node service running a LES server
|
||||
// LesServer is a node service running a LES server
|
||||
type LesServer struct {
|
||||
lesCommons
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ type LesServer struct {
|
|||
priorityClientPool *priorityClientPool
|
||||
}
|
||||
|
||||
// NewLesServer - ctor creating a LES server node service
|
||||
// NewLesServer creates a LES server node service
|
||||
func NewLesServer(eth *eth.Ethereum, config *eth.Config) (*LesServer, error) {
|
||||
quitSync := make(chan struct{})
|
||||
pm, err := NewProtocolManager(
|
||||
|
|
@ -132,7 +132,7 @@ func NewLesServer(eth *eth.Ethereum, config *eth.Config) (*LesServer, error) {
|
|||
return srv, nil
|
||||
}
|
||||
|
||||
// APIs - the RPC APIs offered by this server
|
||||
// APIs lists the RPC APIs offered by this server
|
||||
func (s *LesServer) APIs() []rpc.API {
|
||||
return []rpc.API{
|
||||
{
|
||||
|
|
@ -186,7 +186,7 @@ func (s *LesServer) startEventLoop() {
|
|||
}()
|
||||
}
|
||||
|
||||
// Protocols - rlpx capabilities offered by this LES server
|
||||
// Protocols lists the rlpx capabilities offered by this LES server
|
||||
func (s *LesServer) Protocols() []p2p.Protocol {
|
||||
return s.makeProtocols(ServerProtocolVersions)
|
||||
}
|
||||
|
|
@ -235,7 +235,7 @@ func (s *LesServer) Start(srvr *p2p.Server) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// SetBloomBitsIndexer - adds the bloombits indexer as a child indexer to the bloomtrie indexer
|
||||
// SetBloomBitsIndexer adds the bloombits indexer as a child indexer to the bloomtrie indexer
|
||||
func (s *LesServer) SetBloomBitsIndexer(bloomIndexer *core.ChainIndexer) {
|
||||
bloomIndexer.AddChildIndexer(s.bloomTrieIndexer)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue