Skip to content

Commit 50ee279

Browse files
authored
Merge pull request bnb-chain#3705 from karalabe/drop-legacy-commands
Drop legacy commands
2 parents 562ccff + aca066f commit 50ee279

4 files changed

Lines changed: 0 additions & 446 deletions

File tree

‎cmd/ethtest/main.go‎

Lines changed: 0 additions & 224 deletions
This file was deleted.

‎cmd/geth/chaincmd.go‎

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package main
1919
import (
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.
7271
Optional second and third arguments control the first and
7372
last block to write. In this mode, the file will be appended
7473
if 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-
301247
func 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-
}

‎cmd/geth/main.go‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ func init() {
6565
initCommand,
6666
importCommand,
6767
exportCommand,
68-
upgradedbCommand,
6968
removedbCommand,
7069
dumpCommand,
7170
// See monitorcmd.go:

0 commit comments

Comments
 (0)