mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
Correct formatting
This commit is contained in:
parent
a986522822
commit
4e10c85518
3 changed files with 44 additions and 46 deletions
|
|
@ -1502,21 +1502,27 @@ func SetDashboardConfig(ctx *cli.Context, cfg *dashboard.Config) {
|
||||||
func RegisterLesClientService(stack *node.Node, cfg *eth.Config) {
|
func RegisterLesClientService(stack *node.Node, cfg *eth.Config) {
|
||||||
|
|
||||||
//if the light client is requested
|
//if the light client is requested
|
||||||
if cfg.SyncMode == downloader.LightSync {
|
if cfg.SyncMode != downloader.LightSync {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
//register a light client
|
//register a light client
|
||||||
if err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) {
|
if err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) {
|
||||||
return les.New(ctx, cfg)
|
return les.New(ctx, cfg)
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
Fatalf("Failed to register the Light Client service: %v", err)
|
Fatalf("Failed to register the Light Client service: %v", err)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// RegisterLesServerService adds a Light Server service to the stack if the config permits
|
// RegisterLesServerService adds a Light Server service to the stack if the config permits
|
||||||
func RegisterLesServerService(stack *node.Node, cfg *eth.Config) {
|
func RegisterLesServerService(stack *node.Node, cfg *eth.Config) {
|
||||||
|
|
||||||
//if the light client is not requested and the light server is requested
|
//if the light client is not requested and the light server is requested
|
||||||
if cfg.SyncMode != downloader.LightSync && cfg.LightServ > 0 {
|
if cfg.SyncMode == downloader.LightSync || cfg.LightServ <= 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
//register a light server service
|
//register a light server service
|
||||||
if err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) {
|
if err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) {
|
||||||
//check if the main Eth protocol service is running
|
//check if the main Eth protocol service is running
|
||||||
|
|
@ -1528,21 +1534,24 @@ func RegisterLesServerService(stack *node.Node, cfg *eth.Config) {
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
Fatalf("Failed to register the Light Server service: %v", err)
|
Fatalf("Failed to register the Light Server service: %v", err)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// RegisterEthService adds an Ethereum client to the stack if the config permits
|
// RegisterEthService adds an Ethereum client to the stack if the config permits
|
||||||
func RegisterEthService(stack *node.Node, cfg *eth.Config) {
|
func RegisterEthService(stack *node.Node, cfg *eth.Config) {
|
||||||
|
|
||||||
//if the light client is not requested
|
//if the light client is not requested
|
||||||
if cfg.SyncMode != downloader.LightSync {
|
if cfg.SyncMode == downloader.LightSync {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
//register a service for the Eth protocol
|
//register a service for the Eth protocol
|
||||||
if err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) {
|
if err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) {
|
||||||
return eth.New(ctx, cfg)
|
return eth.New(ctx, cfg)
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
Fatalf("Failed to register the Ethereum service: %v", err)
|
Fatalf("Failed to register the Ethereum service: %v", err)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// RegisterDashboardService adds a dashboard to the stack.
|
// RegisterDashboardService adds a dashboard to the stack.
|
||||||
|
|
|
||||||
|
|
@ -47,25 +47,16 @@ import (
|
||||||
const (
|
const (
|
||||||
softResponseLimit = 2 * 1024 * 1024 // Target maximum size of returned blocks, headers or node data.
|
softResponseLimit = 2 * 1024 * 1024 // Target maximum size of returned blocks, headers or node data.
|
||||||
estHeaderRlpSize = 500 // Approximate size of an RLP encoded block header
|
estHeaderRlpSize = 500 // Approximate size of an RLP encoded block header
|
||||||
|
|
||||||
ethVersion = 63 // equivalent eth version for the downloader
|
ethVersion = 63 // equivalent eth version for the downloader
|
||||||
|
|
||||||
// MaxHeaderFetch is the maximum number of block headers to be fetched per retrieval request
|
MaxHeaderFetch = 192 // the maximum number of block headers to be fetched per retrieval request
|
||||||
MaxHeaderFetch = 192
|
MaxBodyFetch = 32 // the maximum number of block bodies to be fetched per retrieval request
|
||||||
// MaxBodyFetch is the maximum number of block bodies to be fetched per retrieval request
|
MaxReceiptFetch = 128 // is the maximum number of transaction receipts to allow to be fetched per request
|
||||||
MaxBodyFetch = 32
|
MaxCodeFetch = 64 // is the maximum number of contract codes to allow to be fetched per request
|
||||||
// MaxReceiptFetch is the maximum number of transaction receipts to allow to be fetched per request
|
MaxProofsFetch = 64 // is the maximum number of merkle proofs to be fetched per retrieval request
|
||||||
MaxReceiptFetch = 128
|
MaxHelperTrieProofsFetch = 64 // is the maximum number of merkle proofs to be fetched per retrieval request
|
||||||
// MaxCodeFetch is the maximum number of contract codes to allow to be fetched per request
|
MaxTxSend = 64 // is the maximum number of transactions to be sent per request
|
||||||
MaxCodeFetch = 64
|
MaxTxStatus = 256 // is the maximum number of transactions to queried per request
|
||||||
// MaxProofsFetch is the maximum number of merkle proofs to be fetched per retrieval request
|
|
||||||
MaxProofsFetch = 64
|
|
||||||
// MaxHelperTrieProofsFetch is the maximum number of merkle proofs to be fetched per retrieval request
|
|
||||||
MaxHelperTrieProofsFetch = 64
|
|
||||||
// MaxTxSend is the maximum number of transactions to be sent per request
|
|
||||||
MaxTxSend = 64
|
|
||||||
// MaxTxStatus is the maximum number of transactions to queried per request
|
|
||||||
MaxTxStatus = 256
|
|
||||||
|
|
||||||
disableClientRemovePeer = false
|
disableClientRemovePeer = false
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -308,9 +308,7 @@ func (s *LesServer) Stop() error {
|
||||||
}()
|
}()
|
||||||
|
|
||||||
s.freeClientPool.stop()
|
s.freeClientPool.stop()
|
||||||
|
|
||||||
s.costTracker.stop()
|
s.costTracker.stop()
|
||||||
|
|
||||||
s.protocolManager.Stop()
|
s.protocolManager.Stop()
|
||||||
s.csvLogger.Stop()
|
s.csvLogger.Stop()
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue