@@ -18,7 +18,7 @@ import (
1818)
1919
2020const (
21- dbExtension = ".db"
21+ DbExtension = ".db"
2222)
2323
2424// EthTxInfo stores information needed to search for event-indexed keys in source DB
@@ -70,7 +70,7 @@ func validatePatchOptions(opts PatchOptions) error {
7070 }
7171
7272 // Construct and validate source database path
73- sourceDBPath := filepath .Join (opts .SourceHome , "data" , opts .DBName + ".db" )
73+ sourceDBPath := filepath .Join (opts .SourceHome , "data" , opts .DBName + DbExtension )
7474 if _ , err := os .Stat (sourceDBPath ); os .IsNotExist (err ) {
7575 return fmt .Errorf ("source database does not exist: %s" , sourceDBPath )
7676 }
@@ -85,11 +85,11 @@ func validatePatchOptions(opts PatchOptions) error {
8585
8686// openSourceDatabase opens the source database for reading
8787func openSourceDatabase (opts PatchOptions ) (dbm.DB , string , error ) {
88- sourceDBPath := filepath .Join (opts .SourceHome , "data" , opts .DBName + ".db" )
88+ sourceDBPath := filepath .Join (opts .SourceHome , "data" , opts .DBName + DbExtension )
8989 sourceDir := filepath .Dir (sourceDBPath )
9090 sourceName := filepath .Base (sourceDBPath )
91- if len (sourceName ) > len (dbExtension ) && sourceName [len (sourceName )- len (dbExtension ):] == dbExtension {
92- sourceName = sourceName [:len (sourceName )- len (dbExtension )]
91+ if len (sourceName ) > len (DbExtension ) && sourceName [len (sourceName )- len (DbExtension ):] == DbExtension {
92+ sourceName = sourceName [:len (sourceName )- len (DbExtension )]
9393 }
9494
9595 sourceDB , err := dbm .NewDB (sourceName , opts .SourceBackend , sourceDir )
@@ -109,7 +109,7 @@ func openTargetDatabase(opts PatchOptions) (dbm.DB, error) {
109109 } else {
110110 targetDir := filepath .Dir (opts .TargetPath )
111111 targetName := filepath .Base (opts .TargetPath )
112- targetName = strings .TrimSuffix (targetName , dbExtension )
112+ targetName = strings .TrimSuffix (targetName , DbExtension )
113113 targetDB , err = dbm .NewDB (targetName , opts .TargetBackend , targetDir )
114114 }
115115 if err != nil {
0 commit comments