mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
cmd: use local flags for dump, omit empty code/storage
This commit is contained in:
parent
419b4240b4
commit
4528c8fa09
4 changed files with 16 additions and 24 deletions
|
|
@ -165,7 +165,7 @@ Remove blockchain and state databases`,
|
|||
utils.IterativeOutputFlag,
|
||||
utils.ExcludeCodeFlag,
|
||||
utils.ExcludeStorageFlag,
|
||||
utils.IncludeMissingPreimagesFlag,
|
||||
utils.IncludeIncompletesFlag,
|
||||
},
|
||||
Category: "BLOCKCHAIN COMMANDS",
|
||||
Description: `
|
||||
|
|
@ -525,10 +525,10 @@ func dump(ctx *cli.Context) error {
|
|||
if err != nil {
|
||||
utils.Fatalf("could not create new state: %v", err)
|
||||
}
|
||||
excludeCode := ctx.GlobalBool(utils.ExcludeCodeFlag.Name)
|
||||
excludeStorage := ctx.GlobalBool(utils.ExcludeStorageFlag.Name)
|
||||
includeMissing := ctx.GlobalBool(utils.IncludeMissingPreimagesFlag.Name)
|
||||
if ctx.GlobalBool(utils.IterativeOutputFlag.Name) {
|
||||
excludeCode := ctx.Bool(utils.ExcludeCodeFlag.Name)
|
||||
excludeStorage := ctx.Bool(utils.ExcludeStorageFlag.Name)
|
||||
includeMissing := ctx.Bool(utils.IncludeIncompletesFlag.Name)
|
||||
if ctx.Bool(utils.IterativeOutputFlag.Name) {
|
||||
state.IterativeDump(excludeCode, excludeStorage, !includeMissing, json.NewEncoder(os.Stdout))
|
||||
} else {
|
||||
if includeMissing {
|
||||
|
|
|
|||
|
|
@ -188,13 +188,6 @@ var (
|
|||
utils.MetricsInfluxDBPasswordFlag,
|
||||
utils.MetricsInfluxDBTagsFlag,
|
||||
}
|
||||
|
||||
dumpFlags = []cli.Flag{
|
||||
utils.IterativeOutputFlag,
|
||||
utils.ExcludeCodeFlag,
|
||||
utils.ExcludeStorageFlag,
|
||||
utils.IncludeMissingPreimagesFlag,
|
||||
}
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
|
@ -238,7 +231,6 @@ func init() {
|
|||
app.Flags = append(app.Flags, debug.Flags...)
|
||||
app.Flags = append(app.Flags, whisperFlags...)
|
||||
app.Flags = append(app.Flags, metricsFlags...)
|
||||
app.Flags = append(app.Flags, dumpFlags...)
|
||||
|
||||
app.Before = func(ctx *cli.Context) error {
|
||||
logdir := ""
|
||||
|
|
|
|||
|
|
@ -197,20 +197,20 @@ var (
|
|||
Usage: "List of trusted ULC servers",
|
||||
}
|
||||
IterativeOutputFlag = cli.BoolFlag{
|
||||
Name: "dump.iterative",
|
||||
Usage: "Print streaming JSON iteratively as json objects, delimited by newlines",
|
||||
Name: "iterative",
|
||||
Usage: "Print streaming JSON iteratively, delimited by newlines",
|
||||
}
|
||||
ExcludeStorageFlag = cli.BoolFlag{
|
||||
Name: "dump.nostorage",
|
||||
Usage: "When set, exclude storage entries (saves db lookups)",
|
||||
Name: "nostorage",
|
||||
Usage: "Exclude storage entries (save db lookups)",
|
||||
}
|
||||
IncludeMissingPreimagesFlag = cli.BoolFlag{
|
||||
Name: "dump.includeincomplete",
|
||||
Usage: "When set, include also those we do not have address of (missing preimage)",
|
||||
IncludeIncompletesFlag = cli.BoolFlag{
|
||||
Name: "incompletes",
|
||||
Usage: "Include accounts for which we don't have the address (missing preimage)",
|
||||
}
|
||||
ExcludeCodeFlag = cli.BoolFlag{
|
||||
Name: "dump.nocode",
|
||||
Usage: "When set, exclude contract code (saves db lookups)",
|
||||
Name: "nocode",
|
||||
Usage: "Exclude contract code (save db lookups)",
|
||||
}
|
||||
defaultSyncMode = eth.DefaultConfig.SyncMode
|
||||
SyncModeFlag = TextMarshalerFlag{
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ type DumpAccount struct {
|
|||
Nonce uint64 `json:"nonce"`
|
||||
Root string `json:"root"`
|
||||
CodeHash string `json:"codeHash"`
|
||||
Code string `json:"code"`
|
||||
Storage map[common.Hash]string `json:"storage"`
|
||||
Code string `json:"code,omitempty"`
|
||||
Storage map[common.Hash]string `json:"storage,omitempty"`
|
||||
Address *common.Address `json:"address,omitempty"` // Address only present in iterative (line-by-line) mode
|
||||
SecureKey hexutil.Bytes `json:"key,omitempty"` // If we don't have address, we can output the key
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue