@@ -209,25 +209,35 @@ var (
209
209
Name : "whitelist" ,
210
210
Usage : "Comma separated block number-to-hash mappings to enforce (<number>=<hash>)" ,
211
211
}
212
- // LES settings
213
- LightServFlag = cli.IntFlag {
212
+ // Light server and client settings
213
+ LightLegacyServFlag = cli.IntFlag { // Deprecated in favor of light.serve, remove in 2021
214
214
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" ,
215
220
Usage : "Maximum percentage of time allowed for serving LES requests (multi-threaded processing allows values over 100)" ,
216
- Value : 0 ,
221
+ Value : eth . DefaultConfig . LightServ ,
217
222
}
218
- LightBandwidthInFlag = cli.IntFlag {
219
- Name : "lightbwin " ,
220
- Usage : "Incoming bandwidth limit for light server (kilobytes/sec, 0 = unlimited)" ,
221
- 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 ,
222
227
}
223
- LightBandwidthOutFlag = cli.IntFlag {
224
- Name : "lightbwout " ,
225
- Usage : "Outgoing bandwidth limit for light server (kilobytes/sec, 0 = unlimited)" ,
226
- 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 ,
227
232
}
228
- LightPeersFlag = cli.IntFlag {
233
+ LightLegacyPeersFlag = cli.IntFlag { // Deprecated in favor of light.maxpeers, remove in 2021
229
234
Name : "lightpeers" ,
230
- 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)" ,
236
+ Value : eth .DefaultConfig .LightPeers ,
237
+ }
238
+ LightMaxPeersFlag = cli.IntFlag {
239
+ Name : "light.maxpeers" ,
240
+ Usage : "Maximum number of light clients to serve, or light servers to attach to" ,
231
241
Value : eth .DefaultConfig .LightPeers ,
232
242
}
233
243
UltraLightServersFlag = cli.StringFlag {
@@ -952,17 +962,23 @@ func setIPC(ctx *cli.Context, cfg *node.Config) {
952
962
953
963
// setLes configures the les server and ultra light client settings from the command line flags.
954
964
func setLes (ctx * cli.Context , cfg * eth.Config ) {
955
- if ctx .GlobalIsSet (LightServFlag .Name ) {
956
- cfg .LightServ = ctx .GlobalInt (LightServFlag .Name )
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 )
957
973
}
958
- if ctx .GlobalIsSet (LightBandwidthInFlag .Name ) {
959
- cfg .LightBandwidthIn = ctx .GlobalInt (LightBandwidthInFlag .Name )
974
+ if ctx .GlobalIsSet (LightEgressFlag .Name ) {
975
+ cfg .LightEgress = ctx .GlobalInt (LightEgressFlag .Name )
960
976
}
961
- if ctx .GlobalIsSet (LightBandwidthOutFlag .Name ) {
962
- cfg .LightBandwidthOut = ctx .GlobalInt (LightBandwidthOutFlag .Name )
977
+ if ctx .GlobalIsSet (LightLegacyPeersFlag .Name ) {
978
+ cfg .LightPeers = ctx .GlobalInt (LightLegacyPeersFlag .Name )
963
979
}
964
- if ctx .GlobalIsSet (LightPeersFlag .Name ) {
965
- cfg .LightPeers = ctx .GlobalInt (LightPeersFlag .Name )
980
+ if ctx .GlobalIsSet (LightMaxPeersFlag .Name ) {
981
+ cfg .LightPeers = ctx .GlobalInt (LightMaxPeersFlag .Name )
966
982
}
967
983
if ctx .GlobalIsSet (UltraLightServersFlag .Name ) {
968
984
cfg .UltraLightServers = strings .Split (ctx .GlobalString (UltraLightServersFlag .Name ), "," )
@@ -1069,19 +1085,22 @@ func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config) {
1069
1085
setBootstrapNodesV5 (ctx , cfg )
1070
1086
1071
1087
lightClient := ctx .GlobalString (SyncModeFlag .Name ) == "light"
1072
- lightServer := ctx .GlobalInt (LightServFlag .Name ) != 0
1073
- lightPeers := ctx .GlobalInt (LightPeersFlag .Name )
1088
+ lightServer := (ctx .GlobalInt (LightLegacyServFlag .Name ) != 0 || ctx .GlobalInt (LightServeFlag .Name ) != 0 )
1074
1089
1090
+ lightPeers := ctx .GlobalInt (LightLegacyPeersFlag .Name )
1091
+ if ctx .GlobalIsSet (LightMaxPeersFlag .Name ) {
1092
+ lightPeers = ctx .GlobalInt (LightMaxPeersFlag .Name )
1093
+ }
1075
1094
if ctx .GlobalIsSet (MaxPeersFlag .Name ) {
1076
1095
cfg .MaxPeers = ctx .GlobalInt (MaxPeersFlag .Name )
1077
- if lightServer && ! ctx .GlobalIsSet (LightPeersFlag .Name ) {
1096
+ if lightServer && ! ctx .GlobalIsSet (LightLegacyPeersFlag . Name ) && ! ctx . GlobalIsSet ( LightMaxPeersFlag .Name ) {
1078
1097
cfg .MaxPeers += lightPeers
1079
1098
}
1080
1099
} else {
1081
1100
if lightServer {
1082
1101
cfg .MaxPeers += lightPeers
1083
1102
}
1084
- if lightClient && ctx .GlobalIsSet (LightPeersFlag .Name ) && cfg .MaxPeers < lightPeers {
1103
+ if lightClient && ( ctx .GlobalIsSet (LightLegacyPeersFlag .Name ) || ctx . GlobalIsSet ( LightMaxPeersFlag . Name ) ) && cfg .MaxPeers < lightPeers {
1085
1104
cfg .MaxPeers = lightPeers
1086
1105
}
1087
1106
}
@@ -1379,9 +1398,9 @@ func SetShhConfig(ctx *cli.Context, stack *node.Node, cfg *whisper.Config) {
1379
1398
func SetEthConfig (ctx * cli.Context , stack * node.Node , cfg * eth.Config ) {
1380
1399
// Avoid conflicting network flags
1381
1400
CheckExclusive (ctx , DeveloperFlag , TestnetFlag , RinkebyFlag , GoerliFlag )
1382
- CheckExclusive (ctx , LightServFlag , SyncModeFlag , "light" )
1383
- // Can't use both ephemeral unlocked and external signer
1384
- 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
+
1385
1404
var ks * keystore.KeyStore
1386
1405
if keystores := stack .AccountManager ().Backends (keystore .KeyStoreType ); len (keystores ) > 0 {
1387
1406
ks = keystores [0 ].(* keystore.KeyStore )
0 commit comments