This commit is contained in:
Zhenguo Niu 2018-09-05 08:57:47 +00:00 committed by GitHub
commit c4c4d7c8e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -364,7 +364,8 @@ func exportPreimages(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
@ -375,7 +376,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
} }