Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
5a81dd97
Unverified
Commit
5a81dd97
authored
Mar 03, 2021
by
gary rong
Committed by
GitHub
Mar 03, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd: retire whisper flags (#22421)
* cmd: retire whisper flags * cmd/geth: remove whisper configs
parent
b24804d8
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
3 additions
and
70 deletions
+3
-70
config.go
cmd/geth/config.go
+2
-29
consolecmd.go
cmd/geth/consolecmd.go
+1
-1
main.go
cmd/geth/main.go
+0
-8
usage.go
cmd/geth/usage.go
+0
-4
flags.go
cmd/utils/flags.go
+0
-28
No files found.
cmd/geth/config.go
View file @
5a81dd97
...
...
@@ -30,7 +30,6 @@ import (
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/eth/ethconfig"
"github.com/ethereum/go-ethereum/internal/ethapi"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/params"
...
...
@@ -43,7 +42,7 @@ var (
Name
:
"dumpconfig"
,
Usage
:
"Show configuration values"
,
ArgsUsage
:
""
,
Flags
:
append
(
append
(
nodeFlags
,
rpcFlags
...
),
whisper
Flags
...
),
Flags
:
append
(
nodeFlags
,
rpc
Flags
...
),
Category
:
"MISCELLANEOUS COMMANDS"
,
Description
:
`The dumpconfig command shows configuration values.`
,
}
...
...
@@ -75,19 +74,8 @@ type ethstatsConfig struct {
URL
string
`toml:",omitempty"`
}
// whisper has been deprecated, but clients out there might still have [Shh]
// in their config, which will crash. Cut them some slack by keeping the
// config, and displaying a message that those config switches are ineffectual.
// To be removed circa Q1 2021 -- @gballet.
type
whisperDeprecatedConfig
struct
{
MaxMessageSize
uint32
`toml:",omitempty"`
MinimumAcceptedPOW
float64
`toml:",omitempty"`
RestrictConnectionBetweenLightClients
bool
`toml:",omitempty"`
}
type
gethConfig
struct
{
Eth
ethconfig
.
Config
Shh
whisperDeprecatedConfig
Node
node
.
Config
Ethstats
ethstatsConfig
Metrics
metrics
.
Config
...
...
@@ -132,11 +120,8 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, gethConfig) {
if
err
:=
loadConfig
(
file
,
&
cfg
);
err
!=
nil
{
utils
.
Fatalf
(
"%v"
,
err
)
}
if
cfg
.
Shh
!=
(
whisperDeprecatedConfig
{})
{
log
.
Warn
(
"Deprecated whisper config detected. Whisper has been moved to github.com/ethereum/whisper"
)
}
}
// Apply flags.
utils
.
SetNodeConfig
(
ctx
,
&
cfg
.
Node
)
stack
,
err
:=
node
.
New
(
&
cfg
.
Node
)
...
...
@@ -147,22 +132,11 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, gethConfig) {
if
ctx
.
GlobalIsSet
(
utils
.
EthStatsURLFlag
.
Name
)
{
cfg
.
Ethstats
.
URL
=
ctx
.
GlobalString
(
utils
.
EthStatsURLFlag
.
Name
)
}
utils
.
SetShhConfig
(
ctx
,
stack
)
applyMetricConfig
(
ctx
,
&
cfg
)
return
stack
,
cfg
}
// enableWhisper returns true in case one of the whisper flags is set.
func
checkWhisper
(
ctx
*
cli
.
Context
)
{
for
_
,
flag
:=
range
whisperFlags
{
if
ctx
.
GlobalIsSet
(
flag
.
GetName
())
{
log
.
Warn
(
"deprecated whisper flag detected. Whisper has been moved to github.com/ethereum/whisper"
)
}
}
}
// makeFullNode loads geth configuration and creates the Ethereum backend.
func
makeFullNode
(
ctx
*
cli
.
Context
)
(
*
node
.
Node
,
ethapi
.
Backend
)
{
stack
,
cfg
:=
makeConfigNode
(
ctx
)
...
...
@@ -171,7 +145,6 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
}
backend
:=
utils
.
RegisterEthService
(
stack
,
&
cfg
.
Eth
)
checkWhisper
(
ctx
)
// Configure GraphQL if requested
if
ctx
.
GlobalIsSet
(
utils
.
GraphQLEnabledFlag
.
Name
)
{
utils
.
RegisterGraphQLService
(
stack
,
backend
,
cfg
.
Node
)
...
...
cmd/geth/consolecmd.go
View file @
5a81dd97
...
...
@@ -36,7 +36,7 @@ var (
Action
:
utils
.
MigrateFlags
(
localConsole
),
Name
:
"console"
,
Usage
:
"Start an interactive JavaScript environment"
,
Flags
:
append
(
append
(
append
(
nodeFlags
,
rpcFlags
...
),
consoleFlags
...
),
whisper
Flags
...
),
Flags
:
append
(
append
(
nodeFlags
,
rpcFlags
...
),
console
Flags
...
),
Category
:
"CONSOLE COMMANDS"
,
Description
:
`
The Geth console is an interactive shell for the JavaScript runtime environment
...
...
cmd/geth/main.go
View file @
5a81dd97
...
...
@@ -186,13 +186,6 @@ var (
utils
.
AllowUnprotectedTxs
,
}
whisperFlags
=
[]
cli
.
Flag
{
utils
.
WhisperEnabledFlag
,
utils
.
WhisperMaxMessageSizeFlag
,
utils
.
WhisperMinPOWFlag
,
utils
.
WhisperRestrictConnectionBetweenLightClientsFlag
,
}
metricsFlags
=
[]
cli
.
Flag
{
utils
.
MetricsEnabledFlag
,
utils
.
MetricsEnabledExpensiveFlag
,
...
...
@@ -251,7 +244,6 @@ func init() {
app
.
Flags
=
append
(
app
.
Flags
,
rpcFlags
...
)
app
.
Flags
=
append
(
app
.
Flags
,
consoleFlags
...
)
app
.
Flags
=
append
(
app
.
Flags
,
debug
.
Flags
...
)
app
.
Flags
=
append
(
app
.
Flags
,
whisperFlags
...
)
app
.
Flags
=
append
(
app
.
Flags
,
metricsFlags
...
)
app
.
Before
=
func
(
ctx
*
cli
.
Context
)
error
{
...
...
cmd/geth/usage.go
View file @
5a81dd97
...
...
@@ -216,10 +216,6 @@ var AppHelpFlagGroups = []flags.FlagGroup{
Name
:
"METRICS AND STATS"
,
Flags
:
metricsFlags
,
},
{
Name
:
"WHISPER (deprecated)"
,
Flags
:
whisperFlags
,
},
{
Name
:
"ALIASED (deprecated)"
,
Flags
:
[]
cli
.
Flag
{
...
...
cmd/utils/flags.go
View file @
5a81dd97
...
...
@@ -680,24 +680,6 @@ var (
Usage
:
"Maximum gas price will be recommended by gpo"
,
Value
:
ethconfig
.
Defaults
.
GPO
.
MaxPrice
.
Int64
(),
}
WhisperEnabledFlag
=
cli
.
BoolFlag
{
Name
:
"shh"
,
Usage
:
"Enable Whisper"
,
}
WhisperMaxMessageSizeFlag
=
cli
.
IntFlag
{
Name
:
"shh.maxmessagesize"
,
Usage
:
"Max message size accepted"
,
Value
:
1024
*
1024
,
}
WhisperMinPOWFlag
=
cli
.
Float64Flag
{
Name
:
"shh.pow"
,
Usage
:
"Minimum POW accepted"
,
Value
:
0.2
,
}
WhisperRestrictConnectionBetweenLightClientsFlag
=
cli
.
BoolFlag
{
Name
:
"shh.restrict-light"
,
Usage
:
"Restrict connection between two whisper light clients"
,
}
// Metrics flags
MetricsEnabledFlag
=
cli
.
BoolFlag
{
...
...
@@ -1461,16 +1443,6 @@ func CheckExclusive(ctx *cli.Context, args ...interface{}) {
}
}
// SetShhConfig applies shh-related command line flags to the config.
func
SetShhConfig
(
ctx
*
cli
.
Context
,
stack
*
node
.
Node
)
{
if
ctx
.
GlobalIsSet
(
WhisperEnabledFlag
.
Name
)
||
ctx
.
GlobalIsSet
(
WhisperMaxMessageSizeFlag
.
Name
)
||
ctx
.
GlobalIsSet
(
WhisperMinPOWFlag
.
Name
)
||
ctx
.
GlobalIsSet
(
WhisperRestrictConnectionBetweenLightClientsFlag
.
Name
)
{
log
.
Warn
(
"Whisper support has been deprecated and the code has been moved to github.com/ethereum/whisper"
)
}
}
// SetEthConfig applies eth-related command line flags to the config.
func
SetEthConfig
(
ctx
*
cli
.
Context
,
stack
*
node
.
Node
,
cfg
*
ethconfig
.
Config
)
{
// Avoid conflicting network flags
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment