|
|
@@ -450,15 +450,19 @@ func (bc *BlockChain) ExportN(w io.Writer, first uint64, last uint64) error {
|
|
|
}
|
|
|
log.Info("Exporting batch of blocks", "count", last-first+1)
|
|
|
|
|
|
+ start, reported := time.Now(), time.Now()
|
|
|
for nr := first; nr <= last; nr++ {
|
|
|
block := bc.GetBlockByNumber(nr)
|
|
|
if block == nil {
|
|
|
return fmt.Errorf("export failed on #%d: not found", nr)
|
|
|
}
|
|
|
-
|
|
|
if err := block.EncodeRLP(w); err != nil {
|
|
|
return err
|
|
|
}
|
|
|
+ if time.Since(reported) >= statsReportLimit {
|
|
|
+ log.Info("Exporting blocks", "exported", block.NumberU64()-first, "elapsed", common.PrettyDuration(time.Since(start)))
|
|
|
+ reported = time.Now()
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return nil
|
|
|
@@ -1203,8 +1207,8 @@ type insertStats struct {
|
|
|
startTime mclock.AbsTime
|
|
|
}
|
|
|
|
|
|
-// statsReportLimit is the time limit during import after which we always print
|
|
|
-// out progress. This avoids the user wondering what's going on.
|
|
|
+// statsReportLimit is the time limit during import and export after which we
|
|
|
+// always print out progress. This avoids the user wondering what's going on.
|
|
|
const statsReportLimit = 8 * time.Second
|
|
|
|
|
|
// report prints statistics if some number of blocks have been processed
|