@@ -63,7 +63,6 @@ import (
63
63
"github.com/ethereum/go-ethereum/graphql"
64
64
"github.com/ethereum/go-ethereum/internal/ethapi"
65
65
"github.com/ethereum/go-ethereum/internal/flags"
66
- "github.com/ethereum/go-ethereum/les"
67
66
"github.com/ethereum/go-ethereum/log"
68
67
"github.com/ethereum/go-ethereum/metrics"
69
68
"github.com/ethereum/go-ethereum/metrics/exp"
@@ -318,7 +317,7 @@ var (
318
317
}
319
318
SyncModeFlag = & flags.TextMarshalerFlag {
320
319
Name : "syncmode" ,
321
- Usage : `Blockchain sync mode ("snap", "full" or "light ")` ,
320
+ Usage : `Blockchain sync mode ("snap" or "full ")` ,
322
321
Value : & defaultSyncMode ,
323
322
Category : flags .StateCategory ,
324
323
}
@@ -351,41 +350,6 @@ var (
351
350
Value : ethconfig .Defaults .TransactionHistory ,
352
351
Category : flags .StateCategory ,
353
352
}
354
- // Light server and client settings
355
- LightServeFlag = & cli.IntFlag {
356
- Name : "light.serve" ,
357
- Usage : "Maximum percentage of time allowed for serving LES requests (multi-threaded processing allows values over 100)" ,
358
- Value : ethconfig .Defaults .LightServ ,
359
- Category : flags .LightCategory ,
360
- }
361
- LightIngressFlag = & cli.IntFlag {
362
- Name : "light.ingress" ,
363
- Usage : "Incoming bandwidth limit for serving light clients (kilobytes/sec, 0 = unlimited)" ,
364
- Value : ethconfig .Defaults .LightIngress ,
365
- Category : flags .LightCategory ,
366
- }
367
- LightEgressFlag = & cli.IntFlag {
368
- Name : "light.egress" ,
369
- Usage : "Outgoing bandwidth limit for serving light clients (kilobytes/sec, 0 = unlimited)" ,
370
- Value : ethconfig .Defaults .LightEgress ,
371
- Category : flags .LightCategory ,
372
- }
373
- LightMaxPeersFlag = & cli.IntFlag {
374
- Name : "light.maxpeers" ,
375
- Usage : "Maximum number of light clients to serve, or light servers to attach to" ,
376
- Value : ethconfig .Defaults .LightPeers ,
377
- Category : flags .LightCategory ,
378
- }
379
- LightNoPruneFlag = & cli.BoolFlag {
380
- Name : "light.nopruning" ,
381
- Usage : "Disable ancient light chain data pruning" ,
382
- Category : flags .LightCategory ,
383
- }
384
- LightNoSyncServeFlag = & cli.BoolFlag {
385
- Name : "light.nosyncserve" ,
386
- Usage : "Enables serving light clients before syncing" ,
387
- Category : flags .LightCategory ,
388
- }
389
353
// Transaction pool settings
390
354
TxPoolLocalsFlag = & cli.StringFlag {
391
355
Name : "txpool.locals" ,
@@ -1380,25 +1344,25 @@ func setIPC(ctx *cli.Context, cfg *node.Config) {
1380
1344
}
1381
1345
}
1382
1346
1383
- // setLes configures the les server and ultra light client settings from the command line flags.
1347
+ // setLes shows the deprecation warnings for LES flags.
1384
1348
func setLes (ctx * cli.Context , cfg * ethconfig.Config ) {
1385
1349
if ctx .IsSet (LightServeFlag .Name ) {
1386
- cfg . LightServ = ctx . Int ( LightServeFlag .Name )
1350
+ log . Warn ( "The light server has been deprecated, please remove this flag" , "flag" , LightServeFlag .Name )
1387
1351
}
1388
1352
if ctx .IsSet (LightIngressFlag .Name ) {
1389
- cfg . LightIngress = ctx . Int ( LightIngressFlag .Name )
1353
+ log . Warn ( "The light server has been deprecated, please remove this flag" , "flag" , LightIngressFlag .Name )
1390
1354
}
1391
1355
if ctx .IsSet (LightEgressFlag .Name ) {
1392
- cfg . LightEgress = ctx . Int ( LightEgressFlag .Name )
1356
+ log . Warn ( "The light server has been deprecated, please remove this flag" , "flag" , LightEgressFlag .Name )
1393
1357
}
1394
1358
if ctx .IsSet (LightMaxPeersFlag .Name ) {
1395
- cfg . LightPeers = ctx . Int ( LightMaxPeersFlag .Name )
1359
+ log . Warn ( "The light server has been deprecated, please remove this flag" , "flag" , LightMaxPeersFlag .Name )
1396
1360
}
1397
1361
if ctx .IsSet (LightNoPruneFlag .Name ) {
1398
- cfg . LightNoPrune = ctx . Bool ( LightNoPruneFlag .Name )
1362
+ log . Warn ( "The light server has been deprecated, please remove this flag" , "flag" , LightNoPruneFlag .Name )
1399
1363
}
1400
1364
if ctx .IsSet (LightNoSyncServeFlag .Name ) {
1401
- cfg . LightNoSyncServe = ctx . Bool ( LightNoSyncServeFlag .Name )
1365
+ log . Warn ( "The light server has been deprecated, please remove this flag" , "flag" , LightNoSyncServeFlag .Name )
1402
1366
}
1403
1367
}
1404
1368
@@ -1509,27 +1473,8 @@ func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config) {
1509
1473
setBootstrapNodes (ctx , cfg )
1510
1474
setBootstrapNodesV5 (ctx , cfg )
1511
1475
1512
- lightClient := ctx .String (SyncModeFlag .Name ) == "light"
1513
- lightServer := (ctx .Int (LightServeFlag .Name ) != 0 )
1514
-
1515
- lightPeers := ctx .Int (LightMaxPeersFlag .Name )
1516
- if lightClient && ! ctx .IsSet (LightMaxPeersFlag .Name ) {
1517
- // dynamic default - for clients we use 1/10th of the default for servers
1518
- lightPeers /= 10
1519
- }
1520
-
1521
1476
if ctx .IsSet (MaxPeersFlag .Name ) {
1522
1477
cfg .MaxPeers = ctx .Int (MaxPeersFlag .Name )
1523
- if lightServer && ! ctx .IsSet (LightMaxPeersFlag .Name ) {
1524
- cfg .MaxPeers += lightPeers
1525
- }
1526
- } else {
1527
- if lightServer {
1528
- cfg .MaxPeers += lightPeers
1529
- }
1530
- if lightClient && ctx .IsSet (LightMaxPeersFlag .Name ) && cfg .MaxPeers < lightPeers {
1531
- cfg .MaxPeers = lightPeers
1532
- }
1533
1478
}
1534
1479
// if max peers per ip is not set, use max peers
1535
1480
if cfg .MaxPeersPerIP <= 0 {
@@ -1540,36 +1485,21 @@ func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config) {
1540
1485
cfg .MaxPeersPerIP = ctx .Int (MaxPeersPerIPFlag .Name )
1541
1486
}
1542
1487
1543
- if ! (lightClient || lightServer ) {
1544
- lightPeers = 0
1545
- }
1546
- ethPeers := cfg .MaxPeers - lightPeers
1547
- if lightClient {
1548
- ethPeers = 0
1549
- }
1550
- log .Info ("Maximum peer count" , "ETH" , ethPeers , "LES" , lightPeers , "total" , cfg .MaxPeers )
1488
+ ethPeers := cfg .MaxPeers
1489
+ log .Info ("Maximum peer count" , "ETH" , ethPeers , "total" , cfg .MaxPeers )
1551
1490
1552
1491
if ctx .IsSet (MaxPendingPeersFlag .Name ) {
1553
1492
cfg .MaxPendingPeers = ctx .Int (MaxPendingPeersFlag .Name )
1554
1493
}
1555
- if ctx .IsSet (NoDiscoverFlag .Name ) || lightClient {
1494
+ if ctx .IsSet (NoDiscoverFlag .Name ) {
1556
1495
cfg .NoDiscovery = true
1557
1496
}
1558
1497
1559
- // Disallow --nodiscover when used in conjunction with light mode.
1560
- if (lightClient || lightServer ) && ctx .Bool (NoDiscoverFlag .Name ) {
1561
- Fatalf ("Cannot use --" + NoDiscoverFlag .Name + " in light client or light server mode" )
1562
- }
1563
1498
CheckExclusive (ctx , DiscoveryV4Flag , NoDiscoverFlag )
1564
1499
CheckExclusive (ctx , DiscoveryV5Flag , NoDiscoverFlag )
1565
1500
cfg .DiscoveryV4 = ctx .Bool (DiscoveryV4Flag .Name )
1566
1501
cfg .DiscoveryV5 = ctx .Bool (DiscoveryV5Flag .Name )
1567
1502
1568
- // If we're running a light client or server, force enable the v5 peer discovery.
1569
- if lightClient || lightServer {
1570
- cfg .DiscoveryV5 = true
1571
- }
1572
-
1573
1503
if netrestrict := ctx .String (NetrestrictFlag .Name ); netrestrict != "" {
1574
1504
list , err := netutil .ParseNetlist (netrestrict )
1575
1505
if err != nil {
@@ -1701,12 +1631,7 @@ func setBLSWalletDir(ctx *cli.Context, cfg *node.Config) {
1701
1631
}
1702
1632
}
1703
1633
1704
- func setGPO (ctx * cli.Context , cfg * gasprice.Config , light bool ) {
1705
- // If we are running the light client, apply another group
1706
- // settings for gas oracle.
1707
- if light {
1708
- * cfg = ethconfig .LightClientGPO
1709
- }
1634
+ func setGPO (ctx * cli.Context , cfg * gasprice.Config ) {
1710
1635
if ctx .IsSet (GpoBlocksFlag .Name ) {
1711
1636
cfg .Blocks = ctx .Int (GpoBlocksFlag .Name )
1712
1637
}
@@ -1866,13 +1791,12 @@ func CheckExclusive(ctx *cli.Context, args ...interface{}) {
1866
1791
// SetEthConfig applies eth-related command line flags to the config.
1867
1792
func SetEthConfig (ctx * cli.Context , stack * node.Node , cfg * ethconfig.Config ) {
1868
1793
// Avoid conflicting network flags
1869
- CheckExclusive (ctx , BSCMainnetFlag , DeveloperFlag , ChapelFlag )
1870
- CheckExclusive (ctx , LightServeFlag , SyncModeFlag , "light" )
1794
+ CheckExclusive (ctx , BSCMainnetFlag , DeveloperFlag )
1871
1795
CheckExclusive (ctx , DeveloperFlag , ExternalSignerFlag ) // Can't use both ephemeral unlocked and external signer
1872
1796
1873
1797
// Set configurations from CLI flags
1874
1798
setEtherbase (ctx , cfg )
1875
- setGPO (ctx , & cfg .GPO , ctx . String ( SyncModeFlag . Name ) == "light" )
1799
+ setGPO (ctx , & cfg .GPO )
1876
1800
setTxPool (ctx , & cfg .TxPool )
1877
1801
setMiner (ctx , & cfg .Miner )
1878
1802
setRequiredBlocks (ctx , cfg )
@@ -1986,9 +1910,6 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
1986
1910
cfg .TransactionHistory = 0
1987
1911
log .Warn ("Disabled transaction unindexing for archive node" )
1988
1912
}
1989
- if ctx .IsSet (LightServeFlag .Name ) && cfg .TransactionHistory != 0 {
1990
- log .Warn ("LES server cannot serve old transaction status and cannot connect below les/4 protocol version if transaction lookup index is limited" )
1991
- }
1992
1913
if ctx .IsSet (CacheFlag .Name ) || ctx .IsSet (CacheTrieFlag .Name ) {
1993
1914
cfg .TrieCleanCache = ctx .Int (CacheFlag .Name ) * ctx .Int (CacheTrieFlag .Name ) / 100
1994
1915
}
@@ -2157,9 +2078,6 @@ func SetDNSDiscoveryDefaults(cfg *ethconfig.Config, genesis common.Hash) {
2157
2078
return // already set through flags/config
2158
2079
}
2159
2080
protocol := "all"
2160
- if cfg .SyncMode == downloader .LightSync {
2161
- protocol = "les"
2162
- }
2163
2081
if url := params .KnownDNSNetwork (genesis , protocol ); url != "" {
2164
2082
cfg .EthDiscoveryURLs = []string {url }
2165
2083
cfg .SnapDiscoveryURLs = cfg .EthDiscoveryURLs
@@ -2169,27 +2087,12 @@ func SetDNSDiscoveryDefaults(cfg *ethconfig.Config, genesis common.Hash) {
2169
2087
}
2170
2088
2171
2089
// RegisterEthService adds an Ethereum client to the stack.
2172
- // The second return value is the full node instance, which may be nil if the
2173
- // node is running as a light client.
2090
+ // The second return value is the full node instance.
2174
2091
func RegisterEthService (stack * node.Node , cfg * ethconfig.Config ) (ethapi.Backend , * eth.Ethereum ) {
2175
- if cfg .SyncMode == downloader .LightSync {
2176
- backend , err := les .New (stack , cfg )
2177
- if err != nil {
2178
- Fatalf ("Failed to register the Ethereum service: %v" , err )
2179
- }
2180
- stack .RegisterAPIs (tracers .APIs (backend .ApiBackend ))
2181
- return backend .ApiBackend , nil
2182
- }
2183
2092
backend , err := eth .New (stack , cfg )
2184
2093
if err != nil {
2185
2094
Fatalf ("Failed to register the Ethereum service: %v" , err )
2186
2095
}
2187
- if cfg .LightServ > 0 {
2188
- _ , err := les .NewLesServer (stack , backend , cfg )
2189
- if err != nil {
2190
- Fatalf ("Failed to create the LES server: %v" , err )
2191
- }
2192
- }
2193
2096
stack .RegisterAPIs (tracers .APIs (backend .APIBackend ))
2194
2097
return backend .APIBackend , backend
2195
2098
}
@@ -2238,13 +2141,12 @@ func EnableMinerInfo(ctx *cli.Context, minerConfig miner.Config) SetupMetricsOpt
2238
2141
2239
2142
// RegisterFilterAPI adds the eth log filtering RPC API to the node.
2240
2143
func RegisterFilterAPI (stack * node.Node , backend ethapi.Backend , ethcfg * ethconfig.Config ) * filters.FilterSystem {
2241
- isLightClient := ethcfg .SyncMode == downloader .LightSync
2242
2144
filterSystem := filters .NewFilterSystem (backend , filters.Config {
2243
2145
LogCacheSize : ethcfg .FilterLogCacheSize ,
2244
2146
})
2245
2147
stack .RegisterAPIs ([]rpc.API {{
2246
2148
Namespace : "eth" ,
2247
- Service : filters .NewFilterAPI (filterSystem , isLightClient , ethcfg .RangeLimit ),
2149
+ Service : filters .NewFilterAPI (filterSystem , ethcfg .RangeLimit ),
2248
2150
}})
2249
2151
return filterSystem
2250
2152
}
0 commit comments