From 486907c441988cb325fa57675ea31b93142bbd5e Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Thu, 10 Oct 2013 13:22:55 -0400 Subject: [PATCH] Add -testnet flag to showblock. --- util/showblock/showblock.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/util/showblock/showblock.go b/util/showblock/showblock.go index bec36f05..e68e06db 100644 --- a/util/showblock/showblock.go +++ b/util/showblock/showblock.go @@ -35,7 +35,7 @@ func main() { var dbType string var datadir string var shastring, eshastring, outfile string - var rflag, fflag, tflag bool + var rflag, fflag, tflag, testnetflag bool var progress int end := int64(-1) flag.StringVar(&dbType, "dbtype", "", "Database backend to use for the Block Chain") @@ -47,6 +47,7 @@ func main() { flag.BoolVar(&rflag, "r", false, "raw block") flag.BoolVar(&fflag, "f", false, "fmt block") flag.BoolVar(&tflag, "t", false, "show transactions") + flag.BoolVar(&testnetflag, "testnet", false, "use testnet db") flag.IntVar(&progress, "p", 0, "show progress") flag.Parse() @@ -67,7 +68,11 @@ func main() { if len(datadir) == 0 { datadir = filepath.Join(btcdHomeDir(), "data") } - datadir = filepath.Join(datadir, "testnet") + if testnetflag { + datadir = filepath.Join(datadir, "testnet") + } else { + datadir = filepath.Join(datadir, "mainnet") + } blockDbNamePrefix := "blocks" dbName := blockDbNamePrefix + "_" + dbType