Go fmt new utils.
This commit is contained in:
parent
96b92552b9
commit
fd4b63073f
3 changed files with 34 additions and 36 deletions
|
@ -1,6 +1,6 @@
|
||||||
/*
|
// Copyright (c) 2013 Conformal Systems LLC.
|
||||||
* Copyright (c) 2013 Conformal Systems LLC.
|
// Use of this source code is governed by an ISC
|
||||||
*/
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
|
@ -9,9 +9,9 @@ import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/conformal/btcdb"
|
"github.com/conformal/btcdb"
|
||||||
"github.com/conformal/btcutil"
|
|
||||||
_ "github.com/conformal/btcdb/sqlite3"
|
|
||||||
_ "github.com/conformal/btcdb/ldb"
|
_ "github.com/conformal/btcdb/ldb"
|
||||||
|
_ "github.com/conformal/btcdb/sqlite3"
|
||||||
|
"github.com/conformal/btcutil"
|
||||||
"github.com/conformal/btcwire"
|
"github.com/conformal/btcwire"
|
||||||
"github.com/conformal/seelog"
|
"github.com/conformal/seelog"
|
||||||
"io"
|
"io"
|
||||||
|
@ -37,8 +37,8 @@ type bufQueue struct {
|
||||||
|
|
||||||
type blkQueue struct {
|
type blkQueue struct {
|
||||||
complete chan bool
|
complete chan bool
|
||||||
height int64
|
height int64
|
||||||
blk *btcutil.Block
|
blk *btcutil.Block
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
|
@ -57,7 +57,7 @@ func main() {
|
||||||
datadir = filepath.Join(datadir, "mainnet")
|
datadir = filepath.Join(datadir, "mainnet")
|
||||||
|
|
||||||
blockDbNamePrefix := "blocks"
|
blockDbNamePrefix := "blocks"
|
||||||
dbName := blockDbNamePrefix + "_" + dbType
|
dbName := blockDbNamePrefix + "_" + dbType
|
||||||
if dbType == "sqlite" {
|
if dbType == "sqlite" {
|
||||||
dbName = dbName + ".db"
|
dbName = dbName + ".db"
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,6 @@ func getSha(db btcdb.Db, str string) (btcwire.ShaHash, error) {
|
||||||
return *sha, nil
|
return *sha, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var ntxcnt int64
|
var ntxcnt int64
|
||||||
var txspendcnt int64
|
var txspendcnt int64
|
||||||
var txgivecnt int64
|
var txgivecnt int64
|
||||||
|
@ -180,18 +179,18 @@ func parsesha(argstr string) (argtype int, height int64, psha *btcwire.ShaHash,
|
||||||
|
|
||||||
// btcdHomeDir returns an OS appropriate home directory for btcd.
|
// btcdHomeDir returns an OS appropriate home directory for btcd.
|
||||||
func btcdHomeDir() string {
|
func btcdHomeDir() string {
|
||||||
// Search for Windows APPDATA first. This won't exist on POSIX OSes.
|
// Search for Windows APPDATA first. This won't exist on POSIX OSes.
|
||||||
appData := os.Getenv("APPDATA")
|
appData := os.Getenv("APPDATA")
|
||||||
if appData != "" {
|
if appData != "" {
|
||||||
return filepath.Join(appData, "btcd")
|
return filepath.Join(appData, "btcd")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fall back to standard HOME directory that works for most POSIX OSes.
|
// Fall back to standard HOME directory that works for most POSIX OSes.
|
||||||
home := os.Getenv("HOME")
|
home := os.Getenv("HOME")
|
||||||
if home != "" {
|
if home != "" {
|
||||||
return filepath.Join(home, ".btcd")
|
return filepath.Join(home, ".btcd")
|
||||||
}
|
}
|
||||||
|
|
||||||
// In the worst case, use the current directory.
|
// In the worst case, use the current directory.
|
||||||
return "."
|
return "."
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,8 @@ import (
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/conformal/btcdb"
|
"github.com/conformal/btcdb"
|
||||||
_ "github.com/conformal/btcdb/sqlite3"
|
|
||||||
_ "github.com/conformal/btcdb/ldb"
|
_ "github.com/conformal/btcdb/ldb"
|
||||||
|
_ "github.com/conformal/btcdb/sqlite3"
|
||||||
"github.com/conformal/btcwire"
|
"github.com/conformal/btcwire"
|
||||||
"github.com/conformal/seelog"
|
"github.com/conformal/seelog"
|
||||||
"github.com/davecgh/go-spew/spew"
|
"github.com/davecgh/go-spew/spew"
|
||||||
|
@ -70,13 +70,12 @@ func main() {
|
||||||
datadir = filepath.Join(datadir, "mainnet")
|
datadir = filepath.Join(datadir, "mainnet")
|
||||||
|
|
||||||
blockDbNamePrefix := "blocks"
|
blockDbNamePrefix := "blocks"
|
||||||
dbName := blockDbNamePrefix + "_" + dbType
|
dbName := blockDbNamePrefix + "_" + dbType
|
||||||
if dbType == "sqlite" {
|
if dbType == "sqlite" {
|
||||||
dbName = dbName + ".db"
|
dbName = dbName + ".db"
|
||||||
}
|
}
|
||||||
dbPath := filepath.Join(datadir, dbName)
|
dbPath := filepath.Join(datadir, dbName)
|
||||||
|
|
||||||
|
|
||||||
log.Infof("loading db %v", dbType)
|
log.Infof("loading db %v", dbType)
|
||||||
db, err := btcdb.OpenDB(dbType, dbPath)
|
db, err := btcdb.OpenDB(dbType, dbPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -266,18 +265,18 @@ func parsesha(argstr string) (argtype int, height int64, psha *btcwire.ShaHash,
|
||||||
|
|
||||||
// btcdHomeDir returns an OS appropriate home directory for btcd.
|
// btcdHomeDir returns an OS appropriate home directory for btcd.
|
||||||
func btcdHomeDir() string {
|
func btcdHomeDir() string {
|
||||||
// Search for Windows APPDATA first. This won't exist on POSIX OSes.
|
// Search for Windows APPDATA first. This won't exist on POSIX OSes.
|
||||||
appData := os.Getenv("APPDATA")
|
appData := os.Getenv("APPDATA")
|
||||||
if appData != "" {
|
if appData != "" {
|
||||||
return filepath.Join(appData, "btcd")
|
return filepath.Join(appData, "btcd")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fall back to standard HOME directory that works for most POSIX OSes.
|
// Fall back to standard HOME directory that works for most POSIX OSes.
|
||||||
home := os.Getenv("HOME")
|
home := os.Getenv("HOME")
|
||||||
if home != "" {
|
if home != "" {
|
||||||
return filepath.Join(home, ".btcd")
|
return filepath.Join(home, ".btcd")
|
||||||
}
|
}
|
||||||
|
|
||||||
// In the worst case, use the current directory.
|
// In the worst case, use the current directory.
|
||||||
return "."
|
return "."
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue