improve showblock by setting default datadir and requiring -s
This commit is contained in:
parent
c4d7b2d2c6
commit
2231e04e2b
1 changed files with 5 additions and 5 deletions
|
@ -29,7 +29,7 @@ type config struct {
|
||||||
TestNet3 bool `long:"testnet" description:"Use the test network"`
|
TestNet3 bool `long:"testnet" description:"Use the test network"`
|
||||||
OutFile string `short:"o" description:"outfile"`
|
OutFile string `short:"o" description:"outfile"`
|
||||||
Progress bool `short:"p" description:"show progress"`
|
Progress bool `short:"p" description:"show progress"`
|
||||||
ShaString string `short:"s" description:"Block SHA to process"`
|
ShaString string `short:"s" description:"Block SHA to process" required:"true"`
|
||||||
EShaString string `short:"e" description:"End Block SHA to process"`
|
EShaString string `short:"e" description:"End Block SHA to process"`
|
||||||
RawBlock bool `short:"r" description:"Raw Block"`
|
RawBlock bool `short:"r" description:"Raw Block"`
|
||||||
FmtBlock bool `short:"f" description:"Format Block"`
|
FmtBlock bool `short:"f" description:"Format Block"`
|
||||||
|
@ -46,7 +46,10 @@ const (
|
||||||
func main() {
|
func main() {
|
||||||
end := int64(-1)
|
end := int64(-1)
|
||||||
|
|
||||||
cfg := config{DbType: "leveldb"}
|
cfg := config{
|
||||||
|
DbType: "leveldb",
|
||||||
|
DataDir: filepath.Join(btcdHomeDir(), "data"),
|
||||||
|
}
|
||||||
parser := flags.NewParser(&cfg, flags.Default)
|
parser := flags.NewParser(&cfg, flags.Default)
|
||||||
_, err := parser.Parse()
|
_, err := parser.Parse()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -65,9 +68,6 @@ func main() {
|
||||||
defer log.Flush()
|
defer log.Flush()
|
||||||
btcdb.UseLogger(log)
|
btcdb.UseLogger(log)
|
||||||
|
|
||||||
if len(cfg.DataDir) == 0 {
|
|
||||||
cfg.DataDir = filepath.Join(btcdHomeDir(), "data")
|
|
||||||
}
|
|
||||||
var testnet string
|
var testnet string
|
||||||
if cfg.TestNet3 {
|
if cfg.TestNet3 {
|
||||||
testnet = "testnet"
|
testnet = "testnet"
|
||||||
|
|
Loading…
Reference in a new issue