@@ -19,7 +19,6 @@ package main
1919import (
2020 "fmt"
2121 "os"
22- "path/filepath"
2322 "runtime"
2423 "strconv"
2524 "sync/atomic"
@@ -72,16 +71,6 @@ Requires a first argument of the file to write to.
7271Optional second and third arguments control the first and
7372last block to write. In this mode, the file will be appended
7473if already existing.
75- ` ,
76- }
77- upgradedbCommand = cli.Command {
78- Action : upgradeDB ,
79- Name : "upgradedb" ,
80- Usage : "Upgrade chainblock database" ,
81- ArgsUsage : " " ,
82- Category : "BLOCKCHAIN COMMANDS" ,
83- Description : `
84- TODO: Please write this
8574` ,
8675 }
8776 removedbCommand = cli.Command {
@@ -255,49 +244,6 @@ func removeDB(ctx *cli.Context) error {
255244 return nil
256245}
257246
258- func upgradeDB (ctx * cli.Context ) error {
259- log .Info (fmt .Sprint ("Upgrading blockchain database" ))
260-
261- stack := utils .MakeNode (ctx , clientIdentifier , gitCommit )
262- chain , chainDb := utils .MakeChain (ctx , stack )
263- bcVersion := core .GetBlockChainVersion (chainDb )
264- if bcVersion == 0 {
265- bcVersion = core .BlockChainVersion
266- }
267-
268- // Export the current chain.
269- filename := fmt .Sprintf ("blockchain_%d_%s.chain" , bcVersion , time .Now ().Format ("20060102_150405" ))
270- exportFile := filepath .Join (ctx .GlobalString (utils .DataDirFlag .Name ), filename )
271- if err := utils .ExportChain (chain , exportFile ); err != nil {
272- utils .Fatalf ("Unable to export chain for reimport %s" , err )
273- }
274- chainDb .Close ()
275- if dir := dbDirectory (chainDb ); dir != "" {
276- os .RemoveAll (dir )
277- }
278-
279- // Import the chain file.
280- chain , chainDb = utils .MakeChain (ctx , stack )
281- core .WriteBlockChainVersion (chainDb , core .BlockChainVersion )
282- err := utils .ImportChain (chain , exportFile )
283- chainDb .Close ()
284- if err != nil {
285- utils .Fatalf ("Import error %v (a backup is made in %s, use the import command to import it)" , err , exportFile )
286- } else {
287- os .Remove (exportFile )
288- log .Info (fmt .Sprint ("Import finished" ))
289- }
290- return nil
291- }
292-
293- func dbDirectory (db ethdb.Database ) string {
294- ldb , ok := db .(* ethdb.LDBDatabase )
295- if ! ok {
296- return ""
297- }
298- return ldb .Path ()
299- }
300-
301247func dump (ctx * cli.Context ) error {
302248 stack := makeFullNode (ctx )
303249 chain , chainDb := utils .MakeChain (ctx , stack )
@@ -329,9 +275,3 @@ func hashish(x string) bool {
329275 _ , err := strconv .Atoi (x )
330276 return err != nil
331277}
332-
333- func closeAll (dbs ... ethdb.Database ) {
334- for _ , db := range dbs {
335- db .Close ()
336- }
337- }
0 commit comments