|
|
@ -18,7 +18,6 @@ package main |
|
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
import ( |
|
|
|
"bytes" |
|
|
|
"bytes" |
|
|
|
"errors" |
|
|
|
|
|
|
|
"fmt" |
|
|
|
"fmt" |
|
|
|
"os" |
|
|
|
"os" |
|
|
|
"os/signal" |
|
|
|
"os/signal" |
|
|
@ -418,7 +417,7 @@ func dbGet(ctx *cli.Context) error { |
|
|
|
db := utils.MakeChainDatabase(ctx, stack, true) |
|
|
|
db := utils.MakeChainDatabase(ctx, stack, true) |
|
|
|
defer db.Close() |
|
|
|
defer db.Close() |
|
|
|
|
|
|
|
|
|
|
|
key, err := parseHexOrString(ctx.Args().Get(0)) |
|
|
|
key, err := common.ParseHexOrString(ctx.Args().Get(0)) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.Info("Could not decode the key", "error", err) |
|
|
|
log.Info("Could not decode the key", "error", err) |
|
|
|
return err |
|
|
|
return err |
|
|
@ -444,7 +443,7 @@ func dbDelete(ctx *cli.Context) error { |
|
|
|
db := utils.MakeChainDatabase(ctx, stack, false) |
|
|
|
db := utils.MakeChainDatabase(ctx, stack, false) |
|
|
|
defer db.Close() |
|
|
|
defer db.Close() |
|
|
|
|
|
|
|
|
|
|
|
key, err := parseHexOrString(ctx.Args().Get(0)) |
|
|
|
key, err := common.ParseHexOrString(ctx.Args().Get(0)) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.Info("Could not decode the key", "error", err) |
|
|
|
log.Info("Could not decode the key", "error", err) |
|
|
|
return err |
|
|
|
return err |
|
|
@ -477,7 +476,7 @@ func dbPut(ctx *cli.Context) error { |
|
|
|
data []byte |
|
|
|
data []byte |
|
|
|
err error |
|
|
|
err error |
|
|
|
) |
|
|
|
) |
|
|
|
key, err = parseHexOrString(ctx.Args().Get(0)) |
|
|
|
key, err = common.ParseHexOrString(ctx.Args().Get(0)) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.Info("Could not decode the key", "error", err) |
|
|
|
log.Info("Could not decode the key", "error", err) |
|
|
|
return err |
|
|
|
return err |
|
|
@ -584,15 +583,6 @@ func freezerInspect(ctx *cli.Context) error { |
|
|
|
return nil |
|
|
|
return nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ParseHexOrString tries to hexdecode b, but if the prefix is missing, it instead just returns the raw bytes
|
|
|
|
|
|
|
|
func parseHexOrString(str string) ([]byte, error) { |
|
|
|
|
|
|
|
b, err := hexutil.Decode(str) |
|
|
|
|
|
|
|
if errors.Is(err, hexutil.ErrMissingPrefix) { |
|
|
|
|
|
|
|
return []byte(str), nil |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return b, err |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func importLDBdata(ctx *cli.Context) error { |
|
|
|
func importLDBdata(ctx *cli.Context) error { |
|
|
|
start := 0 |
|
|
|
start := 0 |
|
|
|
switch ctx.NArg() { |
|
|
|
switch ctx.NArg() { |
|
|
|