added ulc config params (#1255)

* added ulc config params

* fmt

* fix lint
This commit is contained in:
b00ris 2018-10-24 19:31:41 +03:00 committed by GitHub
parent 29b55bd445
commit bdbceba6eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 4 deletions

View File

@ -218,6 +218,10 @@ func activateLightEthService(stack *node.Node, config *params.NodeConfig) error
ethConf.SyncMode = downloader.LightSync ethConf.SyncMode = downloader.LightSync
ethConf.NetworkId = config.NetworkID ethConf.NetworkId = config.NetworkID
ethConf.DatabaseCache = config.LightEthConfig.DatabaseCache ethConf.DatabaseCache = config.LightEthConfig.DatabaseCache
ethConf.ULC = &eth.ULCConfig{
TrustedServers: config.LightEthConfig.TrustedNodes,
MinTrustedFraction: config.LightEthConfig.MinTrustedFraction,
}
return stack.Register(func(ctx *node.ServiceContext) (node.Service, error) { return stack.Register(func(ctx *node.ServiceContext) (node.Service, error) {
return les.New(ctx, &ethConf) return les.New(ctx, &ethConf)
}) })

View File

@ -31,6 +31,12 @@ type LightEthConfig struct {
// DatabaseCache is memory (in MBs) allocated to internal caching (min 16MB / database forced) // DatabaseCache is memory (in MBs) allocated to internal caching (min 16MB / database forced)
DatabaseCache int DatabaseCache int
// TrustedNodes is a list of trusted servers
TrustedNodes []string
//MinTrustedFraction is minimum percentage of connected trusted servers to validate header(1-100)
MinTrustedFraction int
} }
// ---------- // ----------

View File

@ -48,9 +48,9 @@ func NewPublicAPI(s *Service) *PublicAPI {
filters: make(map[rpc.ID]filter), filters: make(map[rpc.ID]filter),
latestBlockChangedEvent: s.latestBlockChangedEvent, latestBlockChangedEvent: s.latestBlockChangedEvent,
transactionSentToUpstreamEvent: s.transactionSentToUpstreamEvent, transactionSentToUpstreamEvent: s.transactionSentToUpstreamEvent,
client: func() ContextCaller { return s.rpc.RPCClient() }, client: func() ContextCaller { return s.rpc.RPCClient() },
filterLivenessLoop: defaultFilterLivenessPeriod, filterLivenessLoop: defaultFilterLivenessPeriod,
filterLivenessPeriod: defaultFilterLivenessPeriod + 10*time.Second, filterLivenessPeriod: defaultFilterLivenessPeriod + 10*time.Second,
} }
go api.timeoutLoop(s.quit) go api.timeoutLoop(s.quit)
return api return api

View File

@ -27,7 +27,7 @@ func New(rpc rpcProvider) *Service {
return &Service{ return &Service{
latestBlockChangedEvent: latestBlockChangedEvent, latestBlockChangedEvent: latestBlockChangedEvent,
transactionSentToUpstreamEvent: transactionSentToUpstreamEvent, transactionSentToUpstreamEvent: transactionSentToUpstreamEvent,
rpc: rpc, rpc: rpc,
} }
} }