@@ -174,20 +174,6 @@ var (
174174 Name : "exitwhensynced" ,
175175 Usage : "Exits after block synchronisation completes" ,
176176 }
177- UltraLightServersFlag = cli.StringFlag {
178- Name : "ulc.servers" ,
179- Usage : "List of trusted ultra-light servers" ,
180- Value : strings .Join (eth .DefaultConfig .UltraLightServers , "," ),
181- }
182- UltraLightFractionFlag = cli.IntFlag {
183- Name : "ulc.fraction" ,
184- Usage : "Minimum % of trusted ultra-light servers required to announce a new head" ,
185- Value : eth .DefaultConfig .UltraLightFraction ,
186- }
187- UltraLightOnlyAnnounceFlag = cli.BoolFlag {
188- Name : "ulc.onlyannounce" ,
189- Usage : "Ultra light server sends announcements only" ,
190- }
191177 IterativeOutputFlag = cli.BoolFlag {
192178 Name : "iterative" ,
193179 Usage : "Print streaming JSON iteratively, delimited by newlines" ,
@@ -215,33 +201,58 @@ var (
215201 Usage : `Blockchain garbage collection mode ("full", "archive")` ,
216202 Value : "full" ,
217203 }
218- LightServFlag = cli.IntFlag {
204+ LightKDFFlag = cli.BoolFlag {
205+ Name : "lightkdf" ,
206+ Usage : "Reduce key-derivation RAM & CPU usage at some expense of KDF strength" ,
207+ }
208+ WhitelistFlag = cli.StringFlag {
209+ Name : "whitelist" ,
210+ Usage : "Comma separated block number-to-hash mappings to enforce (<number>=<hash>)" ,
211+ }
212+ // Light server and client settings
213+ LightLegacyServFlag = cli.IntFlag { // Deprecated in favor of light.serve, remove in 2021
219214 Name : "lightserv" ,
215+ Usage : "Maximum percentage of time allowed for serving LES requests (deprecated, use --light.serve)" ,
216+ Value : eth .DefaultConfig .LightServ ,
217+ }
218+ LightServeFlag = cli.IntFlag {
219+ Name : "light.serve" ,
220220 Usage : "Maximum percentage of time allowed for serving LES requests (multi-threaded processing allows values over 100)" ,
221- Value : 0 ,
221+ Value : eth . DefaultConfig . LightServ ,
222222 }
223- LightBandwidthInFlag = cli.IntFlag {
224- Name : "lightbwin " ,
225- Usage : "Incoming bandwidth limit for light server (kilobytes/sec, 0 = unlimited)" ,
226- Value : 0 ,
223+ LightIngressFlag = cli.IntFlag {
224+ Name : "light.ingress " ,
225+ Usage : "Incoming bandwidth limit for serving light clients (kilobytes/sec, 0 = unlimited)" ,
226+ Value : eth . DefaultConfig . LightIngress ,
227227 }
228- LightBandwidthOutFlag = cli.IntFlag {
229- Name : "lightbwout " ,
230- Usage : "Outgoing bandwidth limit for light server (kilobytes/sec, 0 = unlimited)" ,
231- Value : 0 ,
228+ LightEgressFlag = cli.IntFlag {
229+ Name : "light.egress " ,
230+ Usage : "Outgoing bandwidth limit for serving light clients (kilobytes/sec, 0 = unlimited)" ,
231+ Value : eth . DefaultConfig . LightEgress ,
232232 }
233- LightPeersFlag = cli.IntFlag {
233+ LightLegacyPeersFlag = cli.IntFlag { // Deprecated in favor of light.maxpeers, remove in 2021
234234 Name : "lightpeers" ,
235- Usage : "Maximum number of LES client peers " ,
235+ Usage : "Maximum number of light clients to serve, or light servers to attach to (deprecated, use --light.maxpeers) " ,
236236 Value : eth .DefaultConfig .LightPeers ,
237237 }
238- LightKDFFlag = cli.BoolFlag {
239- Name : "lightkdf" ,
240- Usage : "Reduce key-derivation RAM & CPU usage at some expense of KDF strength" ,
238+ LightMaxPeersFlag = cli.IntFlag {
239+ Name : "light.maxpeers" ,
240+ Usage : "Maximum number of light clients to serve, or light servers to attach to" ,
241+ Value : eth .DefaultConfig .LightPeers ,
241242 }
242- WhitelistFlag = cli.StringFlag {
243- Name : "whitelist" ,
244- Usage : "Comma separated block number-to-hash mappings to enforce (<number>=<hash>)" ,
243+ UltraLightServersFlag = cli.StringFlag {
244+ Name : "ulc.servers" ,
245+ Usage : "List of trusted ultra-light servers" ,
246+ Value : strings .Join (eth .DefaultConfig .UltraLightServers , "," ),
247+ }
248+ UltraLightFractionFlag = cli.IntFlag {
249+ Name : "ulc.fraction" ,
250+ Usage : "Minimum % of trusted ultra-light servers required to announce a new head" ,
251+ Value : eth .DefaultConfig .UltraLightFraction ,
252+ }
253+ UltraLightOnlyAnnounceFlag = cli.BoolFlag {
254+ Name : "ulc.onlyannounce" ,
255+ Usage : "Ultra light server sends announcements only" ,
245256 }
246257 // Dashboard settings
247258 DashboardEnabledFlag = cli.BoolFlag {
@@ -949,8 +960,26 @@ func setIPC(ctx *cli.Context, cfg *node.Config) {
949960 }
950961}
951962
952- // setUltraLight configures the ultra light client settings from the command line flags.
953- func setUltraLight (ctx * cli.Context , cfg * eth.Config ) {
963+ // setLes configures the les server and ultra light client settings from the command line flags.
964+ func setLes (ctx * cli.Context , cfg * eth.Config ) {
965+ if ctx .GlobalIsSet (LightLegacyServFlag .Name ) {
966+ cfg .LightServ = ctx .GlobalInt (LightLegacyServFlag .Name )
967+ }
968+ if ctx .GlobalIsSet (LightServeFlag .Name ) {
969+ cfg .LightServ = ctx .GlobalInt (LightServeFlag .Name )
970+ }
971+ if ctx .GlobalIsSet (LightIngressFlag .Name ) {
972+ cfg .LightIngress = ctx .GlobalInt (LightIngressFlag .Name )
973+ }
974+ if ctx .GlobalIsSet (LightEgressFlag .Name ) {
975+ cfg .LightEgress = ctx .GlobalInt (LightEgressFlag .Name )
976+ }
977+ if ctx .GlobalIsSet (LightLegacyPeersFlag .Name ) {
978+ cfg .LightPeers = ctx .GlobalInt (LightLegacyPeersFlag .Name )
979+ }
980+ if ctx .GlobalIsSet (LightMaxPeersFlag .Name ) {
981+ cfg .LightPeers = ctx .GlobalInt (LightMaxPeersFlag .Name )
982+ }
954983 if ctx .GlobalIsSet (UltraLightServersFlag .Name ) {
955984 cfg .UltraLightServers = strings .Split (ctx .GlobalString (UltraLightServersFlag .Name ), "," )
956985 }
@@ -1056,19 +1085,22 @@ func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config) {
10561085 setBootstrapNodesV5 (ctx , cfg )
10571086
10581087 lightClient := ctx .GlobalString (SyncModeFlag .Name ) == "light"
1059- lightServer := ctx .GlobalInt (LightServFlag .Name ) != 0
1060- lightPeers := ctx .GlobalInt (LightPeersFlag .Name )
1088+ lightServer := (ctx .GlobalInt (LightLegacyServFlag .Name ) != 0 || ctx .GlobalInt (LightServeFlag .Name ) != 0 )
10611089
1090+ lightPeers := ctx .GlobalInt (LightLegacyPeersFlag .Name )
1091+ if ctx .GlobalIsSet (LightMaxPeersFlag .Name ) {
1092+ lightPeers = ctx .GlobalInt (LightMaxPeersFlag .Name )
1093+ }
10621094 if ctx .GlobalIsSet (MaxPeersFlag .Name ) {
10631095 cfg .MaxPeers = ctx .GlobalInt (MaxPeersFlag .Name )
1064- if lightServer && ! ctx .GlobalIsSet (LightPeersFlag .Name ) {
1096+ if lightServer && ! ctx .GlobalIsSet (LightLegacyPeersFlag . Name ) && ! ctx . GlobalIsSet ( LightMaxPeersFlag .Name ) {
10651097 cfg .MaxPeers += lightPeers
10661098 }
10671099 } else {
10681100 if lightServer {
10691101 cfg .MaxPeers += lightPeers
10701102 }
1071- if lightClient && ctx .GlobalIsSet (LightPeersFlag .Name ) && cfg .MaxPeers < lightPeers {
1103+ if lightClient && ( ctx .GlobalIsSet (LightLegacyPeersFlag .Name ) || ctx . GlobalIsSet ( LightMaxPeersFlag . Name ) ) && cfg .MaxPeers < lightPeers {
10721104 cfg .MaxPeers = lightPeers
10731105 }
10741106 }
@@ -1366,9 +1398,9 @@ func SetShhConfig(ctx *cli.Context, stack *node.Node, cfg *whisper.Config) {
13661398func SetEthConfig (ctx * cli.Context , stack * node.Node , cfg * eth.Config ) {
13671399 // Avoid conflicting network flags
13681400 CheckExclusive (ctx , DeveloperFlag , TestnetFlag , RinkebyFlag , GoerliFlag )
1369- CheckExclusive (ctx , LightServFlag , SyncModeFlag , "light" )
1370- // Can't use both ephemeral unlocked and external signer
1371- CheckExclusive ( ctx , DeveloperFlag , ExternalSignerFlag )
1401+ CheckExclusive (ctx , LightLegacyServFlag , LightServeFlag , SyncModeFlag , "light" )
1402+ CheckExclusive ( ctx , DeveloperFlag , ExternalSignerFlag ) // Can't use both ephemeral unlocked and external signer
1403+
13721404 var ks * keystore.KeyStore
13731405 if keystores := stack .AccountManager ().Backends (keystore .KeyStoreType ); len (keystores ) > 0 {
13741406 ks = keystores [0 ].(* keystore.KeyStore )
@@ -1379,19 +1411,11 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
13791411 setEthash (ctx , cfg )
13801412 setMiner (ctx , & cfg .Miner )
13811413 setWhitelist (ctx , cfg )
1382- setUltraLight (ctx , cfg )
1414+ setLes (ctx , cfg )
13831415
13841416 if ctx .GlobalIsSet (SyncModeFlag .Name ) {
13851417 cfg .SyncMode = * GlobalTextMarshaler (ctx , SyncModeFlag .Name ).(* downloader.SyncMode )
13861418 }
1387- if ctx .GlobalIsSet (LightServFlag .Name ) {
1388- cfg .LightServ = ctx .GlobalInt (LightServFlag .Name )
1389- }
1390- cfg .LightBandwidthIn = ctx .GlobalInt (LightBandwidthInFlag .Name )
1391- cfg .LightBandwidthOut = ctx .GlobalInt (LightBandwidthOutFlag .Name )
1392- if ctx .GlobalIsSet (LightPeersFlag .Name ) {
1393- cfg .LightPeers = ctx .GlobalInt (LightPeersFlag .Name )
1394- }
13951419 if ctx .GlobalIsSet (NetworkIdFlag .Name ) {
13961420 cfg .NetworkId = ctx .GlobalUint64 (NetworkIdFlag .Name )
13971421 }
0 commit comments