@@ -54,10 +54,13 @@ participating.
5454 Action : importChain ,
5555 Name : "import" ,
5656 Usage : "Import a blockchain file" ,
57- ArgsUsage : "<filename>" ,
57+ ArgsUsage : "<filename> (<filename 2> ... <filename N>) " ,
5858 Category : "BLOCKCHAIN COMMANDS" ,
5959 Description : `
60- TODO: Please write this
60+ The import command imports blocks from an RLP-encoded form. The form can be one file
61+ with several RLP-encoded blocks, or several files can be used.
62+ If only one file is used, import error will result in failure. If several files are used,
63+ processing will proceed even if an individual RLP-file import failure occurs.
6164` ,
6265 }
6366 exportCommand = cli.Command {
@@ -122,7 +125,7 @@ func initGenesis(ctx *cli.Context) error {
122125}
123126
124127func importChain (ctx * cli.Context ) error {
125- if len (ctx .Args ()) != 1 {
128+ if len (ctx .Args ()) < 1 {
126129 utils .Fatalf ("This command requires an argument." )
127130 }
128131 stack := makeFullNode (ctx )
@@ -146,9 +149,19 @@ func importChain(ctx *cli.Context) error {
146149 }()
147150 // Import the chain
148151 start := time .Now ()
149- if err := utils .ImportChain (chain , ctx .Args ().First ()); err != nil {
150- utils .Fatalf ("Import error: %v" , err )
152+
153+ if len (ctx .Args ()) == 1 {
154+ if err := utils .ImportChain (chain , ctx .Args ().First ()); err != nil {
155+ utils .Fatalf ("Import error: %v" , err )
156+ }
157+ } else {
158+ for _ , arg := range ctx .Args () {
159+ if err := utils .ImportChain (chain , arg ); err != nil {
160+ log .Error ("Import error" , "file" , arg , "err" , err )
161+ }
162+ }
151163 }
164+
152165 fmt .Printf ("Import done in %v.\n \n " , time .Since (start ))
153166
154167 // Output pre-compaction stats mostly to see the import trashing
@@ -171,6 +184,10 @@ func importChain(ctx *cli.Context) error {
171184 fmt .Printf ("Allocations: %.3f million\n " , float64 (mem .Mallocs )/ 1000000 )
172185 fmt .Printf ("GC pause: %v\n \n " , time .Duration (mem .PauseTotalNs ))
173186
187+ if ctx .GlobalIsSet (utils .NoCompactionFlag .Name ) {
188+ return nil
189+ }
190+
174191 // Compact the entire database to more accurately measure disk io and print the stats
175192 start = time .Now ()
176193 fmt .Println ("Compacting entire database..." )
0 commit comments