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,47 +1502,56 @@ func SetDashboardConfig(ctx *cli.Context, cfg *dashboard.Config) {
|
|||
func RegisterLesClientService(stack *node.Node, cfg *eth.Config) {
|
||||
|
||||
//if the light client is requested
|
||||
if cfg.SyncMode == downloader.LightSync {
|
||||
//register a light client
|
||||
if err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) {
|
||||
return les.New(ctx, cfg)
|
||||
}); err != nil {
|
||||
Fatalf("Failed to register the Light Client service: %v", err)
|
||||
}
|
||||
if cfg.SyncMode != downloader.LightSync {
|
||||
return
|
||||
}
|
||||
|
||||
//register a light client
|
||||
if err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) {
|
||||
return les.New(ctx, cfg)
|
||||
}); err != nil {
|
||||
Fatalf("Failed to register the Light Client service: %v", err)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// RegisterLesServerService adds a Light Server service to the stack if the config permits
|
||||
func RegisterLesServerService(stack *node.Node, cfg *eth.Config) {
|
||||
|
||||
//if the light client is not requested and the light server is requested
|
||||
if cfg.SyncMode != downloader.LightSync && cfg.LightServ > 0 {
|
||||
//register a light server service
|
||||
if err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) {
|
||||
//check if the main Eth protocol service is running
|
||||
var ethService *eth.Ethereum
|
||||
if ctx.Service(ðService) != nil {
|
||||
return nil, errors.New("Failed to start the Les Server service because Ethereum service is not running")
|
||||
}
|
||||
return les.NewLesServer(ethService, cfg)
|
||||
}); err != nil {
|
||||
Fatalf("Failed to register the Light Server service: %v", err)
|
||||
}
|
||||
if cfg.SyncMode == downloader.LightSync || cfg.LightServ <= 0 {
|
||||
return
|
||||
}
|
||||
|
||||
//register a light server service
|
||||
if err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) {
|
||||
//check if the main Eth protocol service is running
|
||||
var ethService *eth.Ethereum
|
||||
if ctx.Service(ðService) != nil {
|
||||
return nil, errors.New("Failed to start the Les Server service because Ethereum service is not running")
|
||||
}
|
||||
return les.NewLesServer(ethService, cfg)
|
||||
}); err != nil {
|
||||
Fatalf("Failed to register the Light Server service: %v", err)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// RegisterEthService adds an Ethereum client to the stack if the config permits
|
||||
func RegisterEthService(stack *node.Node, cfg *eth.Config) {
|
||||
|
||||
//if the light client is not requested
|
||||
if cfg.SyncMode != downloader.LightSync {
|
||||
//register a service for the Eth protocol
|
||||
if err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) {
|
||||
return eth.New(ctx, cfg)
|
||||
}); err != nil {
|
||||
Fatalf("Failed to register the Ethereum service: %v", err)
|
||||
}
|
||||
if cfg.SyncMode == downloader.LightSync {
|
||||
return
|
||||
}
|
||||
|
||||
//register a service for the Eth protocol
|
||||
if err := stack.Register(func(ctx *node.ServiceContext) (node.Service, error) {
|
||||
return eth.New(ctx, cfg)
|
||||
}); err != nil {
|
||||
Fatalf("Failed to register the Ethereum service: %v", err)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// RegisterDashboardService adds a dashboard to the stack.
|
||||
|
|
|
|||
|
|
@ -47,25 +47,16 @@ import (
|
|||
const (
|
||||
softResponseLimit = 2 * 1024 * 1024 // Target maximum size of returned blocks, headers or node data.
|
||||
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
|
||||
// MaxBodyFetch is the maximum number of block bodies to be fetched per retrieval request
|
||||
MaxBodyFetch = 32
|
||||
// MaxReceiptFetch is the maximum number of transaction receipts to allow to be fetched per request
|
||||
MaxReceiptFetch = 128
|
||||
// MaxCodeFetch is the maximum number of contract codes to allow to be fetched per request
|
||||
MaxCodeFetch = 64
|
||||
// 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
|
||||
MaxHeaderFetch = 192 // the maximum number of block headers to be fetched per retrieval request
|
||||
MaxBodyFetch = 32 // 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
|
||||
MaxCodeFetch = 64 // is the maximum number of contract codes to allow to be fetched per request
|
||||
MaxProofsFetch = 64 // is the maximum number of merkle proofs to be fetched per retrieval request
|
||||
MaxHelperTrieProofsFetch = 64 // is the maximum number of merkle proofs to be fetched per retrieval request
|
||||
MaxTxSend = 64 // is the maximum number of transactions to be sent per request
|
||||
MaxTxStatus = 256 // is the maximum number of transactions to queried per request
|
||||
|
||||
disableClientRemovePeer = false
|
||||
)
|
||||
|
|
|
|||
|
|
@ -308,9 +308,7 @@ func (s *LesServer) Stop() error {
|
|||
}()
|
||||
|
||||
s.freeClientPool.stop()
|
||||
|
||||
s.costTracker.stop()
|
||||
|
||||
s.protocolManager.Stop()
|
||||
s.csvLogger.Stop()
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Reference in a new issue