@@ -174,20 +174,6 @@ var (
174
174
Name : "exitwhensynced" ,
175
175
Usage : "Exits after block synchronisation completes" ,
176
176
}
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
- }
191
177
IterativeOutputFlag = cli.BoolFlag {
192
178
Name : "iterative" ,
193
179
Usage : "Print streaming JSON iteratively, delimited by newlines" ,
@@ -215,33 +201,58 @@ var (
215
201
Usage : `Blockchain garbage collection mode ("full", "archive")` ,
216
202
Value : "full" ,
217
203
}
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
219
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" ,
220
220
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 ,
222
222
}
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 ,
227
227
}
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 ,
232
232
}
233
- LightPeersFlag = cli.IntFlag {
233
+ LightLegacyPeersFlag = cli.IntFlag { // Deprecated in favor of light.maxpeers, remove in 2021
234
234
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) " ,
236
236
Value : eth .DefaultConfig .LightPeers ,
237
237
}
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 ,
241
242
}
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" ,
245
256
}
246
257
// Dashboard settings
247
258
DashboardEnabledFlag = cli.BoolFlag {
@@ -949,8 +960,26 @@ func setIPC(ctx *cli.Context, cfg *node.Config) {
949
960
}
950
961
}
951
962
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
+ }
954
983
if ctx .GlobalIsSet (UltraLightServersFlag .Name ) {
955
984
cfg .UltraLightServers = strings .Split (ctx .GlobalString (UltraLightServersFlag .Name ), "," )
956
985
}
@@ -1056,19 +1085,22 @@ func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config) {
1056
1085
setBootstrapNodesV5 (ctx , cfg )
1057
1086
1058
1087
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 )
1061
1089
1090
+ lightPeers := ctx .GlobalInt (LightLegacyPeersFlag .Name )
1091
+ if ctx .GlobalIsSet (LightMaxPeersFlag .Name ) {
1092
+ lightPeers = ctx .GlobalInt (LightMaxPeersFlag .Name )
1093
+ }
1062
1094
if ctx .GlobalIsSet (MaxPeersFlag .Name ) {
1063
1095
cfg .MaxPeers = ctx .GlobalInt (MaxPeersFlag .Name )
1064
- if lightServer && ! ctx .GlobalIsSet (LightPeersFlag .Name ) {
1096
+ if lightServer && ! ctx .GlobalIsSet (LightLegacyPeersFlag . Name ) && ! ctx . GlobalIsSet ( LightMaxPeersFlag .Name ) {
1065
1097
cfg .MaxPeers += lightPeers
1066
1098
}
1067
1099
} else {
1068
1100
if lightServer {
1069
1101
cfg .MaxPeers += lightPeers
1070
1102
}
1071
- if lightClient && ctx .GlobalIsSet (LightPeersFlag .Name ) && cfg .MaxPeers < lightPeers {
1103
+ if lightClient && ( ctx .GlobalIsSet (LightLegacyPeersFlag .Name ) || ctx . GlobalIsSet ( LightMaxPeersFlag . Name ) ) && cfg .MaxPeers < lightPeers {
1072
1104
cfg .MaxPeers = lightPeers
1073
1105
}
1074
1106
}
@@ -1366,9 +1398,9 @@ func SetShhConfig(ctx *cli.Context, stack *node.Node, cfg *whisper.Config) {
1366
1398
func SetEthConfig (ctx * cli.Context , stack * node.Node , cfg * eth.Config ) {
1367
1399
// Avoid conflicting network flags
1368
1400
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
+
1372
1404
var ks * keystore.KeyStore
1373
1405
if keystores := stack .AccountManager ().Backends (keystore .KeyStoreType ); len (keystores ) > 0 {
1374
1406
ks = keystores [0 ].(* keystore.KeyStore )
@@ -1379,19 +1411,11 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) {
1379
1411
setEthash (ctx , cfg )
1380
1412
setMiner (ctx , & cfg .Miner )
1381
1413
setWhitelist (ctx , cfg )
1382
- setUltraLight (ctx , cfg )
1414
+ setLes (ctx , cfg )
1383
1415
1384
1416
if ctx .GlobalIsSet (SyncModeFlag .Name ) {
1385
1417
cfg .SyncMode = * GlobalTextMarshaler (ctx , SyncModeFlag .Name ).(* downloader.SyncMode )
1386
1418
}
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
- }
1395
1419
if ctx .GlobalIsSet (NetworkIdFlag .Name ) {
1396
1420
cfg .NetworkId = ctx .GlobalUint64 (NetworkIdFlag .Name )
1397
1421
}
0 commit comments