Skip to content

Commit

Permalink
added ulc config params (#1255)
Browse files Browse the repository at this point in the history
* added ulc config params

* fmt

* fix lint
  • Loading branch information
b00ris authored Oct 24, 2018
1 parent 29b55bd commit bdbceba
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
4 changes: 4 additions & 0 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ func activateLightEthService(stack *node.Node, config *params.NodeConfig) error
ethConf.SyncMode = downloader.LightSync
ethConf.NetworkId = config.NetworkID
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 les.New(ctx, &ethConf)
})
Expand Down
6 changes: 6 additions & 0 deletions params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ type LightEthConfig struct {

// DatabaseCache is memory (in MBs) allocated to internal caching (min 16MB / database forced)
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
}

// ----------
Expand Down
6 changes: 3 additions & 3 deletions services/rpcfilters/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ func NewPublicAPI(s *Service) *PublicAPI {
filters: make(map[rpc.ID]filter),
latestBlockChangedEvent: s.latestBlockChangedEvent,
transactionSentToUpstreamEvent: s.transactionSentToUpstreamEvent,
client: func() ContextCaller { return s.rpc.RPCClient() },
filterLivenessLoop: defaultFilterLivenessPeriod,
filterLivenessPeriod: defaultFilterLivenessPeriod + 10*time.Second,
client: func() ContextCaller { return s.rpc.RPCClient() },
filterLivenessLoop: defaultFilterLivenessPeriod,
filterLivenessPeriod: defaultFilterLivenessPeriod + 10*time.Second,
}
go api.timeoutLoop(s.quit)
return api
Expand Down
2 changes: 1 addition & 1 deletion services/rpcfilters/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func New(rpc rpcProvider) *Service {
return &Service{
latestBlockChangedEvent: latestBlockChangedEvent,
transactionSentToUpstreamEvent: transactionSentToUpstreamEvent,
rpc: rpc,
rpc: rpc,
}
}

Expand Down

0 comments on commit bdbceba

Please sign in to comment.