@ -27,7 +27,7 @@ import (
"io"
"io"
"os"
"os"
"os/signal"
"os/signal"
"path"
"path/filepath "
"runtime"
"runtime"
"strings"
"strings"
"syscall"
"syscall"
@ -251,7 +251,7 @@ func ImportHistory(chain *core.BlockChain, db ethdb.Database, dir string, networ
if err != nil {
if err != nil {
return fmt . Errorf ( "error reading %s: %w" , dir , err )
return fmt . Errorf ( "error reading %s: %w" , dir , err )
}
}
checksums , err := readList ( path . Join ( dir , "checksums.txt" ) )
checksums , err := readList ( file path. Join ( dir , "checksums.txt" ) )
if err != nil {
if err != nil {
return fmt . Errorf ( "unable to read checksums.txt: %w" , err )
return fmt . Errorf ( "unable to read checksums.txt: %w" , err )
}
}
@ -268,7 +268,7 @@ func ImportHistory(chain *core.BlockChain, db ethdb.Database, dir string, networ
)
)
for i , filename := range entries {
for i , filename := range entries {
err := func ( ) error {
err := func ( ) error {
f , err := os . Open ( path . Join ( dir , filename ) )
f , err := os . Open ( file path. Join ( dir , filename ) )
if err != nil {
if err != nil {
return fmt . Errorf ( "unable to open era: %w" , err )
return fmt . Errorf ( "unable to open era: %w" , err )
}
}
@ -425,7 +425,7 @@ func ExportHistory(bc *core.BlockChain, dir string, first, last, step uint64) er
)
)
for i := first ; i <= last ; i += step {
for i := first ; i <= last ; i += step {
err := func ( ) error {
err := func ( ) error {
filename := path . Join ( dir , era . Filename ( network , int ( i / step ) , common . Hash { } ) )
filename := file path. Join ( dir , era . Filename ( network , int ( i / step ) , common . Hash { } ) )
f , err := os . Create ( filename )
f , err := os . Create ( filename )
if err != nil {
if err != nil {
return fmt . Errorf ( "could not create era file: %w" , err )
return fmt . Errorf ( "could not create era file: %w" , err )
@ -458,7 +458,7 @@ func ExportHistory(bc *core.BlockChain, dir string, first, last, step uint64) er
return fmt . Errorf ( "export failed to finalize %d: %w" , step / i , err )
return fmt . Errorf ( "export failed to finalize %d: %w" , step / i , err )
}
}
// Set correct filename with root.
// Set correct filename with root.
os . Rename ( filename , path . Join ( dir , era . Filename ( network , int ( i / step ) , root ) ) )
os . Rename ( filename , file path. Join ( dir , era . Filename ( network , int ( i / step ) , root ) ) )
// Compute checksum of entire Era1.
// Compute checksum of entire Era1.
if _ , err := f . Seek ( 0 , io . SeekStart ) ; err != nil {
if _ , err := f . Seek ( 0 , io . SeekStart ) ; err != nil {
@ -481,7 +481,7 @@ func ExportHistory(bc *core.BlockChain, dir string, first, last, step uint64) er
}
}
}
}
os . WriteFile ( path . Join ( dir , "checksums.txt" ) , [ ] byte ( strings . Join ( checksums , "\n" ) ) , os . ModePerm )
os . WriteFile ( file path. Join ( dir , "checksums.txt" ) , [ ] byte ( strings . Join ( checksums , "\n" ) ) , os . ModePerm )
log . Info ( "Exported blockchain to" , "dir" , dir )
log . Info ( "Exported blockchain to" , "dir" , dir )