mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 09:53:48 +00:00
cmd/geth: small change of copydb source path check
This changes to check the first arg length instead of checking if there's only one arg for the required source path to follow more conventions.
This commit is contained in:
parent
fe6cf00f48
commit
1b9afa41f7
1 changed files with 3 additions and 2 deletions
|
|
@ -305,7 +305,8 @@ func exportChain(ctx *cli.Context) error {
|
||||||
|
|
||||||
func copyDb(ctx *cli.Context) error {
|
func copyDb(ctx *cli.Context) error {
|
||||||
// Ensure we have a source chain directory to copy
|
// Ensure we have a source chain directory to copy
|
||||||
if len(ctx.Args()) != 1 {
|
dbPath := ctx.Args().First()
|
||||||
|
if len(dbPath) == 0 {
|
||||||
utils.Fatalf("Source chaindata directory path argument missing")
|
utils.Fatalf("Source chaindata directory path argument missing")
|
||||||
}
|
}
|
||||||
// Initialize a new chain for the running node to sync into
|
// Initialize a new chain for the running node to sync into
|
||||||
|
|
@ -316,7 +317,7 @@ func copyDb(ctx *cli.Context) error {
|
||||||
dl := downloader.New(syncmode, chainDb, new(event.TypeMux), chain, nil, nil)
|
dl := downloader.New(syncmode, chainDb, new(event.TypeMux), chain, nil, nil)
|
||||||
|
|
||||||
// Create a source peer to satisfy downloader requests from
|
// Create a source peer to satisfy downloader requests from
|
||||||
db, err := ethdb.NewLDBDatabase(ctx.Args().First(), ctx.GlobalInt(utils.CacheFlag.Name), 256)
|
db, err := ethdb.NewLDBDatabase(dbPath, ctx.GlobalInt(utils.CacheFlag.Name), 256)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue