go-ethereum: github.com/ethereum/go-ethereum/les Index | Files | Directories

package les

import "github.com/ethereum/go-ethereum/les"

Package les implements the Light Ethereum Subprotocol.

Index

Package Files

api.go api_backend.go benchmark.go bloombits.go client.go client_handler.go clientpool.go commons.go costtracker.go distributor.go enr_entry.go fetcher.go metrics.go odr.go odr_requests.go peer.go protocol.go pruner.go retrieve.go server.go server_handler.go serverpool.go servingqueue.go sync.go test_helper.go txrelay.go ulc.go

Constants

const (
    MsgBlockBodies = iota
    MsgCode
    MsgReceipts
    MsgProofsV2
    MsgHelperTrieProofs
    MsgTxStatus
)
const (
    NetworkId          = 1
    ProtocolMaxMsgSize = 10 * 1024 * 1024 // Maximum cap on the size of a protocol message
)
const (
    // Protocol messages inherited from LPV1
    StatusMsg          = 0x00
    AnnounceMsg        = 0x01
    GetBlockHeadersMsg = 0x02
    BlockHeadersMsg    = 0x03
    GetBlockBodiesMsg  = 0x04
    BlockBodiesMsg     = 0x05
    GetReceiptsMsg     = 0x06
    ReceiptsMsg        = 0x07
    GetCodeMsg         = 0x0a
    CodeMsg            = 0x0b
    // Protocol messages introduced in LPV2
    GetProofsV2Msg         = 0x0f
    ProofsV2Msg            = 0x10
    GetHelperTrieProofsMsg = 0x11
    HelperTrieProofsMsg    = 0x12
    SendTxV2Msg            = 0x13
    GetTxStatusMsg         = 0x14
    TxStatusMsg            = 0x15
    // Protocol messages introduced in LPV3
    StopMsg   = 0x16
    ResumeMsg = 0x17
)

les protocol message codes

const (
    ErrMsgTooLarge = iota
    ErrDecode
    ErrInvalidMsgCode
    ErrProtocolVersionMismatch
    ErrNetworkIdMismatch
    ErrGenesisBlockMismatch
    ErrNoStatusMsg
    ErrExtraStatusMsg
    ErrSuspendedPeer
    ErrUselessPeer
    ErrRequestRejected
    ErrUnexpectedResponse
    ErrInvalidResponse
    ErrTooManyTimeouts
    ErrMissingKey
)
const (
    MaxHeaderFetch           = 192 // Amount of block headers to be fetched per retrieval request
    MaxBodyFetch             = 32  // Amount of block bodies to be fetched per retrieval request
    MaxReceiptFetch          = 128 // Amount of transaction receipts to allow fetching per request
    MaxCodeFetch             = 64  // Amount of contract codes to allow fetching per request
    MaxProofsFetch           = 64  // Amount of merkle proofs to be fetched per retrieval request
    MaxHelperTrieProofsFetch = 64  // Amount of helper tries to be fetched per retrieval request
    MaxTxSend                = 64  // Amount of transactions to be send per request
    MaxTxStatus              = 256 // Amount of transactions to queried per request
)

Variables

var (
    ClientProtocolVersions    = []uint{lpv2, lpv3}
    ServerProtocolVersions    = []uint{lpv2, lpv3}
    AdvertiseProtocolVersions = []uint{lpv2} // clients are searching for the first advertised protocol in the list
)

Supported versions of the les protocol (first is primary)

var ProtocolLengths = map[uint]uint64{/* contains filtered or unexported fields */}

Number of implemented message corresponding to different protocol versions.

type BlockRequest Uses

type BlockRequest light.BlockRequest

BlockRequest is the ODR request type for block bodies

func (*BlockRequest) CanSend Uses

func (r *BlockRequest) CanSend(peer *serverPeer) bool

CanSend tells if a certain peer is suitable for serving the given request

func (*BlockRequest) GetCost Uses

func (r *BlockRequest) GetCost(peer *serverPeer) uint64

GetCost returns the cost of the given ODR request according to the serving peer's cost table (implementation of LesOdrRequest)

func (*BlockRequest) Request Uses

func (r *BlockRequest) Request(reqID uint64, peer *serverPeer) error

Request sends an ODR request to the LES network (implementation of LesOdrRequest)

func (*BlockRequest) Validate Uses

func (r *BlockRequest) Validate(db ethdb.Database, msg *Msg) error

Valid processes an ODR request reply message from the LES network returns true and stores results in memory if the message was a valid reply to the request (implementation of LesOdrRequest)

type BloomReq Uses

type BloomReq struct {
    BloomTrieNum, BitIdx, SectionIndex, FromLevel uint64
}

type BloomRequest Uses

type BloomRequest light.BloomRequest

ODR request type for requesting headers by Canonical Hash Trie, see LesOdrRequest interface

func (*BloomRequest) CanSend Uses

func (r *BloomRequest) CanSend(peer *serverPeer) bool

CanSend tells if a certain peer is suitable for serving the given request

func (*BloomRequest) GetCost Uses

func (r *BloomRequest) GetCost(peer *serverPeer) uint64

GetCost returns the cost of the given ODR request according to the serving peer's cost table (implementation of LesOdrRequest)

func (*BloomRequest) Request Uses

func (r *BloomRequest) Request(reqID uint64, peer *serverPeer) error

Request sends an ODR request to the LES network (implementation of LesOdrRequest)

func (*BloomRequest) Validate Uses

func (r *BloomRequest) Validate(db ethdb.Database, msg *Msg) error

Valid processes an ODR request reply message from the LES network returns true and stores results in memory if the message was a valid reply to the request (implementation of LesOdrRequest)

type ChtRequest Uses

type ChtRequest light.ChtRequest

ODR request type for requesting headers by Canonical Hash Trie, see LesOdrRequest interface

func (*ChtRequest) CanSend Uses

func (r *ChtRequest) CanSend(peer *serverPeer) bool

CanSend tells if a certain peer is suitable for serving the given request

func (*ChtRequest) GetCost Uses

func (r *ChtRequest) GetCost(peer *serverPeer) uint64

GetCost returns the cost of the given ODR request according to the serving peer's cost table (implementation of LesOdrRequest)

func (*ChtRequest) Request Uses

func (r *ChtRequest) Request(reqID uint64, peer *serverPeer) error

Request sends an ODR request to the LES network (implementation of LesOdrRequest)

func (*ChtRequest) Validate Uses

func (r *ChtRequest) Validate(db ethdb.Database, msg *Msg) error

Valid processes an ODR request reply message from the LES network returns true and stores results in memory if the message was a valid reply to the request (implementation of LesOdrRequest)

type CodeData Uses

type CodeData []struct {
    Value []byte
}

CodeData is the network response packet for a node data retrieval.

type CodeReq Uses

type CodeReq struct {
    BHash  common.Hash
    AccKey []byte
}

type CodeRequest Uses

type CodeRequest light.CodeRequest

ODR request type for node data (used for retrieving contract code), see LesOdrRequest interface

func (*CodeRequest) CanSend Uses

func (r *CodeRequest) CanSend(peer *serverPeer) bool

CanSend tells if a certain peer is suitable for serving the given request

func (*CodeRequest) GetCost Uses

func (r *CodeRequest) GetCost(peer *serverPeer) uint64

GetCost returns the cost of the given ODR request according to the serving peer's cost table (implementation of LesOdrRequest)

func (*CodeRequest) Request Uses

func (r *CodeRequest) Request(reqID uint64, peer *serverPeer) error

Request sends an ODR request to the LES network (implementation of LesOdrRequest)

func (*CodeRequest) Validate Uses

func (r *CodeRequest) Validate(db ethdb.Database, msg *Msg) error

Valid processes an ODR request reply message from the LES network returns true and stores results in memory if the message was a valid reply to the request (implementation of LesOdrRequest)

type HelperTrieReq Uses

type HelperTrieReq struct {
    Type              uint
    TrieIdx           uint64
    Key               []byte
    FromLevel, AuxReq uint
}

type HelperTrieResps Uses

type HelperTrieResps struct {
    Proofs  light.NodeList
    AuxData [][]byte
}

type LesApiBackend Uses

type LesApiBackend struct {
    // contains filtered or unexported fields
}

func (*LesApiBackend) AccountManager Uses

func (b *LesApiBackend) AccountManager() *accounts.Manager

func (*LesApiBackend) BlockByHash Uses

func (b *LesApiBackend) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)

func (*LesApiBackend) BlockByNumber Uses

func (b *LesApiBackend) BlockByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Block, error)

func (*LesApiBackend) BlockByNumberOrHash Uses

func (b *LesApiBackend) BlockByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (*types.Block, error)

func (*LesApiBackend) BloomStatus Uses

func (b *LesApiBackend) BloomStatus() (uint64, uint64)

func (*LesApiBackend) ChainConfig Uses

func (b *LesApiBackend) ChainConfig() *params.ChainConfig

func (*LesApiBackend) ChainDb Uses

func (b *LesApiBackend) ChainDb() ethdb.Database

func (*LesApiBackend) CurrentBlock Uses

func (b *LesApiBackend) CurrentBlock() *types.Block

func (*LesApiBackend) CurrentHeader Uses

func (b *LesApiBackend) CurrentHeader() *types.Header

func (*LesApiBackend) Downloader Uses

func (b *LesApiBackend) Downloader() *downloader.Downloader

func (*LesApiBackend) Engine Uses

func (b *LesApiBackend) Engine() consensus.Engine

func (*LesApiBackend) ExtRPCEnabled Uses

func (b *LesApiBackend) ExtRPCEnabled() bool

func (*LesApiBackend) GetEVM Uses

func (b *LesApiBackend) GetEVM(ctx context.Context, msg core.Message, state *state.StateDB, header *types.Header) (*vm.EVM, func() error, error)

func (*LesApiBackend) GetLogs Uses

func (b *LesApiBackend) GetLogs(ctx context.Context, hash common.Hash) ([][]*types.Log, error)

func (*LesApiBackend) GetPoolNonce Uses

func (b *LesApiBackend) GetPoolNonce(ctx context.Context, addr common.Address) (uint64, error)

func (*LesApiBackend) GetPoolTransaction Uses

func (b *LesApiBackend) GetPoolTransaction(txHash common.Hash) *types.Transaction

func (*LesApiBackend) GetPoolTransactions Uses

func (b *LesApiBackend) GetPoolTransactions() (types.Transactions, error)

func (*LesApiBackend) GetReceipts Uses

func (b *LesApiBackend) GetReceipts(ctx context.Context, hash common.Hash) (types.Receipts, error)

func (*LesApiBackend) GetTd Uses

func (b *LesApiBackend) GetTd(ctx context.Context, hash common.Hash) *big.Int

func (*LesApiBackend) GetTransaction Uses

func (b *LesApiBackend) GetTransaction(ctx context.Context, txHash common.Hash) (*types.Transaction, common.Hash, uint64, uint64, error)

func (*LesApiBackend) HeaderByHash Uses

func (b *LesApiBackend) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)

func (*LesApiBackend) HeaderByNumber Uses

func (b *LesApiBackend) HeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Header, error)

func (*LesApiBackend) HeaderByNumberOrHash Uses

func (b *LesApiBackend) HeaderByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (*types.Header, error)

func (*LesApiBackend) ProtocolVersion Uses

func (b *LesApiBackend) ProtocolVersion() int

func (*LesApiBackend) RPCGasCap Uses

func (b *LesApiBackend) RPCGasCap() uint64

func (*LesApiBackend) RPCTxFeeCap Uses

func (b *LesApiBackend) RPCTxFeeCap() float64

func (*LesApiBackend) RemoveTx Uses

func (b *LesApiBackend) RemoveTx(txHash common.Hash)

func (*LesApiBackend) SendTx Uses

func (b *LesApiBackend) SendTx(ctx context.Context, signedTx *types.Transaction) error

func (*LesApiBackend) ServiceFilter Uses

func (b *LesApiBackend) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession)

func (*LesApiBackend) SetHead Uses

func (b *LesApiBackend) SetHead(number uint64)

func (*LesApiBackend) StateAndHeaderByNumber Uses

func (b *LesApiBackend) StateAndHeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*state.StateDB, *types.Header, error)

func (*LesApiBackend) StateAndHeaderByNumberOrHash Uses

func (b *LesApiBackend) StateAndHeaderByNumberOrHash(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) (*state.StateDB, *types.Header, error)

func (*LesApiBackend) Stats Uses

func (b *LesApiBackend) Stats() (pending int, queued int)

func (*LesApiBackend) SubscribeChainEvent Uses

func (b *LesApiBackend) SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription

func (*LesApiBackend) SubscribeChainHeadEvent Uses

func (b *LesApiBackend) SubscribeChainHeadEvent(ch chan<- core.ChainHeadEvent) event.Subscription

func (*LesApiBackend) SubscribeChainSideEvent Uses

func (b *LesApiBackend) SubscribeChainSideEvent(ch chan<- core.ChainSideEvent) event.Subscription

func (*LesApiBackend) SubscribeLogsEvent Uses

func (b *LesApiBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription

func (*LesApiBackend) SubscribeNewTxsEvent Uses

func (b *LesApiBackend) SubscribeNewTxsEvent(ch chan<- core.NewTxsEvent) event.Subscription

func (*LesApiBackend) SubscribePendingLogsEvent Uses

func (b *LesApiBackend) SubscribePendingLogsEvent(ch chan<- []*types.Log) event.Subscription

func (*LesApiBackend) SubscribeRemovedLogsEvent Uses

func (b *LesApiBackend) SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent) event.Subscription

func (*LesApiBackend) SuggestPrice Uses

func (b *LesApiBackend) SuggestPrice(ctx context.Context) (*big.Int, error)

func (*LesApiBackend) TxPoolContent Uses

func (b *LesApiBackend) TxPoolContent() (map[common.Address]types.Transactions, map[common.Address]types.Transactions)

type LesOdr Uses

type LesOdr struct {
    // contains filtered or unexported fields
}

LesOdr implements light.OdrBackend

func NewLesOdr Uses

func NewLesOdr(db ethdb.Database, config *light.IndexerConfig, retriever *retrieveManager) *LesOdr

func (*LesOdr) BloomIndexer Uses

func (odr *LesOdr) BloomIndexer() *core.ChainIndexer

BloomIndexer returns the bloombits chain indexer

func (*LesOdr) BloomTrieIndexer Uses

func (odr *LesOdr) BloomTrieIndexer() *core.ChainIndexer

BloomTrieIndexer returns the bloom trie chain indexer

func (*LesOdr) ChtIndexer Uses

func (odr *LesOdr) ChtIndexer() *core.ChainIndexer

ChtIndexer returns the CHT chain indexer

func (*LesOdr) Database Uses

func (odr *LesOdr) Database() ethdb.Database

Database returns the backing database

func (*LesOdr) IndexerConfig Uses

func (odr *LesOdr) IndexerConfig() *light.IndexerConfig

IndexerConfig returns the indexer config.

func (*LesOdr) Retrieve Uses

func (odr *LesOdr) Retrieve(ctx context.Context, req light.OdrRequest) (err error)

Retrieve tries to fetch an object from the LES network. If the network retrieval was successful, it stores the object in local db.

func (*LesOdr) SetIndexers Uses

func (odr *LesOdr) SetIndexers(chtIndexer, bloomTrieIndexer, bloomIndexer *core.ChainIndexer)

SetIndexers adds the necessary chain indexers to the ODR backend

func (*LesOdr) Stop Uses

func (odr *LesOdr) Stop()

Stop cancels all pending retrievals

type LesOdrRequest Uses

type LesOdrRequest interface {
    GetCost(*serverPeer) uint64
    CanSend(*serverPeer) bool
    Request(uint64, *serverPeer) error
    Validate(ethdb.Database, *Msg) error
}

func LesRequest Uses

func LesRequest(req light.OdrRequest) LesOdrRequest

type LesServer Uses

type LesServer struct {
    // contains filtered or unexported fields
}

func NewLesServer Uses

func NewLesServer(node *node.Node, e *eth.Ethereum, config *eth.Config) (*LesServer, error)

func (*LesServer) APIs Uses

func (s *LesServer) APIs() []rpc.API

func (*LesServer) Protocols Uses

func (s *LesServer) Protocols() []p2p.Protocol

func (*LesServer) Start Uses

func (s *LesServer) Start() error

Start starts the LES server

func (*LesServer) Stop Uses

func (s *LesServer) Stop() error

Stop stops the LES service

type LightDummyAPI Uses

type LightDummyAPI struct{}

func (*LightDummyAPI) Coinbase Uses

func (s *LightDummyAPI) Coinbase() (common.Address, error)

Coinbase is the address that mining rewards will be send to (alias for Etherbase)

func (*LightDummyAPI) Etherbase Uses

func (s *LightDummyAPI) Etherbase() (common.Address, error)

Etherbase is the address that mining rewards will be send to

func (*LightDummyAPI) Hashrate Uses

func (s *LightDummyAPI) Hashrate() hexutil.Uint

Hashrate returns the POW hashrate

func (*LightDummyAPI) Mining Uses

func (s *LightDummyAPI) Mining() bool

Mining returns an indication if this node is currently mining.

type LightEthereum Uses

type LightEthereum struct {
    ApiBackend *LesApiBackend
    // contains filtered or unexported fields
}

func New Uses

func New(stack *node.Node, config *eth.Config) (*LightEthereum, error)

New creates an instance of the light client.

func (*LightEthereum) APIs Uses

func (s *LightEthereum) APIs() []rpc.API

APIs returns the collection of RPC services the ethereum package offers. NOTE, some of these services probably need to be moved to somewhere else.

func (*LightEthereum) BlockChain Uses

func (s *LightEthereum) BlockChain() *light.LightChain

func (*LightEthereum) Downloader Uses

func (s *LightEthereum) Downloader() *downloader.Downloader

func (*LightEthereum) Engine Uses

func (s *LightEthereum) Engine() consensus.Engine

func (*LightEthereum) EventMux Uses

func (s *LightEthereum) EventMux() *event.TypeMux

func (*LightEthereum) LesVersion Uses

func (s *LightEthereum) LesVersion() int

func (*LightEthereum) Protocols Uses

func (s *LightEthereum) Protocols() []p2p.Protocol

Protocols returns all the currently configured network protocols to start.

func (*LightEthereum) ResetWithGenesisBlock Uses

func (s *LightEthereum) ResetWithGenesisBlock(gb *types.Block)

func (*LightEthereum) Start Uses

func (s *LightEthereum) Start() error

Start implements node.Lifecycle, starting all internal goroutines needed by the light ethereum protocol implementation.

func (*LightEthereum) Stop Uses

func (s *LightEthereum) Stop() error

Stop implements node.Lifecycle, terminating all internal goroutines used by the Ethereum protocol.

func (*LightEthereum) TxPool Uses

func (s *LightEthereum) TxPool() *light.TxPool

type Msg Uses

type Msg struct {
    MsgType int
    ReqID   uint64
    Obj     interface{}
}

Msg encodes a LES message that delivers reply data for a request

type NodeInfo Uses

type NodeInfo struct {
    Network    uint64                   `json:"network"`    // Ethereum network ID (1=Frontier, 2=Morden, Ropsten=3, Rinkeby=4)
    Difficulty *big.Int                 `json:"difficulty"` // Total difficulty of the host's blockchain
    Genesis    common.Hash              `json:"genesis"`    // SHA3 hash of the host's genesis block
    Config     *params.ChainConfig      `json:"config"`     // Chain configuration for the fork rules
    Head       common.Hash              `json:"head"`       // SHA3 hash of the host's best owned block
    CHT        params.TrustedCheckpoint `json:"cht"`        // Trused CHT checkpoint for fast catchup
}

NodeInfo represents a short summary of the Ethereum sub-protocol metadata known about the host peer.

type PrivateDebugAPI Uses

type PrivateDebugAPI struct {
    // contains filtered or unexported fields
}

PrivateDebugAPI provides an API to debug LES light server functionality.

func NewPrivateDebugAPI Uses

func NewPrivateDebugAPI(server *LesServer) *PrivateDebugAPI

NewPrivateDebugAPI creates a new LES light server debug API.

func (*PrivateDebugAPI) FreezeClient Uses

func (api *PrivateDebugAPI) FreezeClient(id enode.ID) error

FreezeClient forces a temporary client freeze which normally happens when the server is overloaded

type PrivateLightAPI Uses

type PrivateLightAPI struct {
    // contains filtered or unexported fields
}

PrivateLightAPI provides an API to access the LES light server or light client.

func NewPrivateLightAPI Uses

func NewPrivateLightAPI(backend *lesCommons) *PrivateLightAPI

NewPrivateLightAPI creates a new LES service API.

func (*PrivateLightAPI) GetCheckpoint Uses

func (api *PrivateLightAPI) GetCheckpoint(index uint64) ([3]string, error)

GetLocalCheckpoint returns the specific local checkpoint package.

The checkpoint package consists of 3 strings:

result[0], 32 bytes hex encoded latest section head hash
result[1], 32 bytes hex encoded latest section canonical hash trie root hash
result[2], 32 bytes hex encoded latest section bloom trie root hash

func (*PrivateLightAPI) GetCheckpointContractAddress Uses

func (api *PrivateLightAPI) GetCheckpointContractAddress() (string, error)

GetCheckpointContractAddress returns the contract contract address in hex format.

func (*PrivateLightAPI) LatestCheckpoint Uses

func (api *PrivateLightAPI) LatestCheckpoint() ([4]string, error)

LatestCheckpoint returns the latest local checkpoint package.

The checkpoint package consists of 4 strings:

result[0], hex encoded latest section index
result[1], 32 bytes hex encoded latest section head hash
result[2], 32 bytes hex encoded latest section canonical hash trie root hash
result[3], 32 bytes hex encoded latest section bloom trie root hash

type PrivateLightServerAPI Uses

type PrivateLightServerAPI struct {
    // contains filtered or unexported fields
}

PrivateLightServerAPI provides an API to access the LES light server.

func NewPrivateLightServerAPI Uses

func NewPrivateLightServerAPI(server *LesServer) *PrivateLightServerAPI

NewPrivateLightServerAPI creates a new LES light server API.

func (*PrivateLightServerAPI) AddBalance Uses

func (api *PrivateLightServerAPI) AddBalance(id enode.ID, amount int64) (balance [2]uint64, err error)

AddBalance adds the given amount to the balance of a client if possible and returns the balance before and after the operation

func (*PrivateLightServerAPI) Benchmark Uses

func (api *PrivateLightServerAPI) Benchmark(setups []map[string]interface{}, passCount, length int) ([]map[string]interface{}, error)

Benchmark runs a request performance benchmark with a given set of measurement setups in multiple passes specified by passCount. The measurement time for each setup in each pass is specified in milliseconds by length.

Note: measurement time is adjusted for each pass depending on the previous ones. Therefore a controlled total measurement time is achievable in multiple passes.

func (*PrivateLightServerAPI) ClientInfo Uses

func (api *PrivateLightServerAPI) ClientInfo(ids []enode.ID) map[enode.ID]map[string]interface{}

ClientInfo returns information about clients listed in the ids list or matching the given tags

func (*PrivateLightServerAPI) PriorityClientInfo Uses

func (api *PrivateLightServerAPI) PriorityClientInfo(start, stop enode.ID, maxCount int) map[enode.ID]map[string]interface{}

PriorityClientInfo returns information about clients with a positive balance in the given ID range (stop excluded). If stop is null then the iterator stops only at the end of the ID space. MaxCount limits the number of results returned. If maxCount limit is applied but there are more potential results then the ID of the next potential result is included in the map with an empty structure assigned to it.

func (*PrivateLightServerAPI) ServerInfo Uses

func (api *PrivateLightServerAPI) ServerInfo() map[string]interface{}

ServerInfo returns global server parameters

func (*PrivateLightServerAPI) SetClientParams Uses

func (api *PrivateLightServerAPI) SetClientParams(ids []enode.ID, params map[string]interface{}) error

SetClientParams sets client parameters for all clients listed in the ids list or all connected clients if the list is empty

func (*PrivateLightServerAPI) SetConnectedBias Uses

func (api *PrivateLightServerAPI) SetConnectedBias(bias time.Duration) error

SetConnectedBias set the connection bias, which is applied to already connected clients So that already connected client won't be kicked out very soon and we can ensure all connected clients can have enough time to request or sync some data. When the input parameter `bias` < 0 (illegal), return error.

func (*PrivateLightServerAPI) SetDefaultParams Uses

func (api *PrivateLightServerAPI) SetDefaultParams(params map[string]interface{}) error

SetDefaultParams sets the default parameters applicable to clients connected in the future

type ProofReq Uses

type ProofReq struct {
    BHash       common.Hash
    AccKey, Key []byte
    FromLevel   uint
}

type ReceiptsRequest Uses

type ReceiptsRequest light.ReceiptsRequest

ReceiptsRequest is the ODR request type for block receipts by block hash

func (*ReceiptsRequest) CanSend Uses

func (r *ReceiptsRequest) CanSend(peer *serverPeer) bool

CanSend tells if a certain peer is suitable for serving the given request

func (*ReceiptsRequest) GetCost Uses

func (r *ReceiptsRequest) GetCost(peer *serverPeer) uint64

GetCost returns the cost of the given ODR request according to the serving peer's cost table (implementation of LesOdrRequest)

func (*ReceiptsRequest) Request Uses

func (r *ReceiptsRequest) Request(reqID uint64, peer *serverPeer) error

Request sends an ODR request to the LES network (implementation of LesOdrRequest)

func (*ReceiptsRequest) Validate Uses

func (r *ReceiptsRequest) Validate(db ethdb.Database, msg *Msg) error

Valid processes an ODR request reply message from the LES network returns true and stores results in memory if the message was a valid reply to the request (implementation of LesOdrRequest)

type RequestCostList Uses

type RequestCostList []requestCostListItem

RequestCostList is a list representation of request costs which is used for database storage and communication through the network

type TrieRequest Uses

type TrieRequest light.TrieRequest

ODR request type for state/storage trie entries, see LesOdrRequest interface

func (*TrieRequest) CanSend Uses

func (r *TrieRequest) CanSend(peer *serverPeer) bool

CanSend tells if a certain peer is suitable for serving the given request

func (*TrieRequest) GetCost Uses

func (r *TrieRequest) GetCost(peer *serverPeer) uint64

GetCost returns the cost of the given ODR request according to the serving peer's cost table (implementation of LesOdrRequest)

func (*TrieRequest) Request Uses

func (r *TrieRequest) Request(reqID uint64, peer *serverPeer) error

Request sends an ODR request to the LES network (implementation of LesOdrRequest)

func (*TrieRequest) Validate Uses

func (r *TrieRequest) Validate(db ethdb.Database, msg *Msg) error

Valid processes an ODR request reply message from the LES network returns true and stores results in memory if the message was a valid reply to the request (implementation of LesOdrRequest)

type TxStatusRequest Uses

type TxStatusRequest light.TxStatusRequest

TxStatusRequest is the ODR request type for transaction status

func (*TxStatusRequest) CanSend Uses

func (r *TxStatusRequest) CanSend(peer *serverPeer) bool

CanSend tells if a certain peer is suitable for serving the given request

func (*TxStatusRequest) GetCost Uses

func (r *TxStatusRequest) GetCost(peer *serverPeer) uint64

GetCost returns the cost of the given ODR request according to the serving peer's cost table (implementation of LesOdrRequest)

func (*TxStatusRequest) Request Uses

func (r *TxStatusRequest) Request(reqID uint64, peer *serverPeer) error

Request sends an ODR request to the LES network (implementation of LesOdrRequest)

func (*TxStatusRequest) Validate Uses

func (r *TxStatusRequest) Validate(db ethdb.Database, msg *Msg) error

Valid processes an ODR request reply message from the LES network returns true and stores results in memory if the message was a valid reply to the request (implementation of LesOdrRequest)

Directories

PathSynopsis
checkpointoraclePackage checkpointoracle is a wrapper of checkpoint oracle contract with additional rules defined.
flowcontrolPackage flowcontrol implements a client side flow control mechanism
lespay/client
lespay/server
utils

Package les imports 66 packages (graph) and is imported by 358 packages. Updated 2020-10-21. Refresh now. Tools for package owners.