@@ -209,25 +209,35 @@ var (
209209 Name : "whitelist" ,
210210 Usage : "Comma separated block number-to-hash mappings to enforce (<number>=<hash>)" ,
211211 }
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
214214 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" ,
215220 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 ,
217222 }
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 ,
222227 }
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 ,
227232 }
228- LightPeersFlag = cli.IntFlag {
233+ LightLegacyPeersFlag = cli.IntFlag { // Deprecated in favor of light.maxpeers, remove in 2021
229234 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" ,
231241 Value : eth .DefaultConfig .LightPeers ,
232242 }
233243 UltraLightServersFlag = cli.StringFlag {
@@ -952,17 +962,23 @@ func setIPC(ctx *cli.Context, cfg *node.Config) {
952962
953963// setLes configures the les server and ultra light client settings from the command line flags.
954964func 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 )
957973 }
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 )
960976 }
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 )
963979 }
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 )
966982 }
967983 if ctx .GlobalIsSet (UltraLightServersFlag .Name ) {
968984 cfg .UltraLightServers = strings .Split (ctx .GlobalString (UltraLightServersFlag .Name ), "," )
@@ -1069,19 +1085,22 @@ func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config) {
10691085 setBootstrapNodesV5 (ctx , cfg )
10701086
10711087 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 )
10741089
1090+ lightPeers := ctx .GlobalInt (LightLegacyPeersFlag .Name )
1091+ if ctx .GlobalIsSet (LightMaxPeersFlag .Name ) {
1092+ lightPeers = ctx .GlobalInt (LightMaxPeersFlag .Name )
1093+ }
10751094 if ctx .GlobalIsSet (MaxPeersFlag .Name ) {
10761095 cfg .MaxPeers = ctx .GlobalInt (MaxPeersFlag .Name )
1077- if lightServer && ! ctx .GlobalIsSet (LightPeersFlag .Name ) {
1096+ if lightServer && ! ctx .GlobalIsSet (LightLegacyPeersFlag . Name ) && ! ctx . GlobalIsSet ( LightMaxPeersFlag .Name ) {
10781097 cfg .MaxPeers += lightPeers
10791098 }
10801099 } else {
10811100 if lightServer {
10821101 cfg .MaxPeers += lightPeers
10831102 }
1084- if lightClient && ctx .GlobalIsSet (LightPeersFlag .Name ) && cfg .MaxPeers < lightPeers {
1103+ if lightClient && ( ctx .GlobalIsSet (LightLegacyPeersFlag .Name ) || ctx . GlobalIsSet ( LightMaxPeersFlag . Name ) ) && cfg .MaxPeers < lightPeers {
10851104 cfg .MaxPeers = lightPeers
10861105 }
10871106 }
@@ -1379,9 +1398,9 @@ func SetShhConfig(ctx *cli.Context, stack *node.Node, cfg *whisper.Config) {
13791398func SetEthConfig (ctx * cli.Context , stack * node.Node , cfg * eth.Config ) {
13801399 // Avoid conflicting network flags
13811400 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+
13851404 var ks * keystore.KeyStore
13861405 if keystores := stack .AccountManager ().Backends (keystore .KeyStoreType ); len (keystores ) > 0 {
13871406 ks = keystores [0 ].(* keystore.KeyStore )
0 commit comments