[lbry] misc: rename btc{d,ctl,wallet} chain{d,ctl,wallet}

Currently, we only change the places where they impact runtime.
Mostly are filenames or paths for executables and databases.

Docs and other textual changes will be updated later to reduce
conflicts when we rebase.

rename
This commit is contained in:
Roy Lee 2018-05-23 14:25:07 -07:00
parent 4f422e29cf
commit 0636c889f5
15 changed files with 32 additions and 32 deletions

View file

@ -38,4 +38,4 @@ VOLUME ["/root/.btcd"]
EXPOSE 8333 8334
ENTRYPOINT ["btcd"]
ENTRYPOINT ["chain"]

View file

@ -24,7 +24,7 @@ const (
)
var (
btcdHomeDir = btcutil.AppDataDir("btcd", false)
btcdHomeDir = btcutil.AppDataDir("chain", false)
defaultDataDir = filepath.Join(btcdHomeDir, "data")
knownDbTypes = database.SupportedDrivers()
activeNetParams = &chaincfg.MainNetParams

View file

@ -27,10 +27,10 @@ const (
)
var (
btcdHomeDir = btcutil.AppDataDir("btcd", false)
btcctlHomeDir = btcutil.AppDataDir("btcctl", false)
btcwalletHomeDir = btcutil.AppDataDir("btcwallet", false)
defaultConfigFile = filepath.Join(btcctlHomeDir, "btcctl.conf")
btcdHomeDir = btcutil.AppDataDir("chain", false)
btcctlHomeDir = btcutil.AppDataDir("chainctl", false)
btcwalletHomeDir = btcutil.AppDataDir("chainwallet", false)
defaultConfigFile = filepath.Join(btcctlHomeDir, "chainctl.conf")
defaultRPCServer = "localhost"
defaultRPCCertFile = filepath.Join(btcdHomeDir, "rpc.cert")
defaultWalletCertFile = filepath.Join(btcwalletHomeDir, "rpc.cert")
@ -231,9 +231,9 @@ func loadConfig() (*config, []string, error) {
// Use config file for RPC server to create default btcctl config
var serverConfigPath string
if preCfg.Wallet {
serverConfigPath = filepath.Join(btcwalletHomeDir, "btcwallet.conf")
serverConfigPath = filepath.Join(btcwalletHomeDir, "chainwallet.conf")
} else {
serverConfigPath = filepath.Join(btcdHomeDir, "btcd.conf")
serverConfigPath = filepath.Join(btcdHomeDir, "chain.conf")
}
err := createDefaultConfigFile(preCfg.ConfigFile, serverConfigPath)

View file

@ -25,7 +25,7 @@ const (
)
var (
btcdHomeDir = btcutil.AppDataDir("btcd", false)
btcdHomeDir = btcutil.AppDataDir("chain", false)
defaultDataDir = filepath.Join(btcdHomeDir, "data")
knownDbTypes = database.SupportedDrivers()
activeNetParams = &chaincfg.MainNetParams

View file

@ -35,11 +35,11 @@ import (
)
const (
defaultConfigFilename = "btcd.conf"
defaultConfigFilename = "chain.conf"
defaultDataDirname = "data"
defaultLogLevel = "info"
defaultLogDirname = "logs"
defaultLogFilename = "btcd.log"
defaultLogFilename = "chain.log"
defaultMaxPeers = 125
defaultBanDuration = time.Hour * 24
defaultBanThreshold = 100
@ -62,13 +62,13 @@ const (
defaultMaxOrphanTransactions = 100
defaultMaxOrphanTxSize = 100000
defaultSigCacheMaxSize = 100000
sampleConfigFilename = "sample-btcd.conf"
sampleConfigFilename = "sample-chain.conf"
defaultTxIndex = false
defaultAddrIndex = false
)
var (
defaultHomeDir = btcutil.AppDataDir("btcd", false)
defaultHomeDir = btcutil.AppDataDir("chain", false)
defaultConfigFile = filepath.Join(defaultHomeDir, defaultConfigFilename)
defaultDataDir = filepath.Join(defaultHomeDir, defaultDataDirname)
knownDbTypes = database.SupportedDrivers()

View file

@ -20,16 +20,16 @@ func TestCreateDefaultConfigFile(t *testing.T) {
if !ok {
t.Fatalf("Failed finding config file path")
}
sampleConfigFile := filepath.Join(filepath.Dir(path), "sample-btcd.conf")
sampleConfigFile := filepath.Join(filepath.Dir(path), "sample-chain.conf")
// Setup a temporary directory
tmpDir, err := ioutil.TempDir("", "btcd")
tmpDir, err := ioutil.TempDir("", "chain")
if err != nil {
t.Fatalf("Failed creating a temporary directory: %v", err)
}
testpath := filepath.Join(tmpDir, "test.conf")
// copy config file to location of btcd binary
// copy config file to location of chain binary
data, err := ioutil.ReadFile(sampleConfigFile)
if err != nil {
t.Fatalf("Failed reading sample config file: %v", err)
@ -38,7 +38,7 @@ func TestCreateDefaultConfigFile(t *testing.T) {
if err != nil {
t.Fatalf("Failed obtaining app path: %v", err)
}
tmpConfigFile := filepath.Join(appPath, "sample-btcd.conf")
tmpConfigFile := filepath.Join(appPath, "sample-chain.conf")
err = ioutil.WriteFile(tmpConfigFile, data, 0644)
if err != nil {
t.Fatalf("Failed copying sample config file: %v", err)

View file

@ -18,7 +18,7 @@ import (
)
var (
btcdHomeDir = btcutil.AppDataDir("btcd", false)
btcdHomeDir = btcutil.AppDataDir("chain", false)
knownDbTypes = database.SupportedDrivers()
activeNetParams = &chaincfg.MainNetParams

View file

@ -1107,7 +1107,7 @@ func main() {
// Load the certificate for the TLS connection which is automatically
// generated by btcd when it starts the RPC server and doesn't already
// have one.
btcdHomeDir := btcutil.AppDataDir("btcd", false)
btcdHomeDir := btcutil.AppDataDir("chain", false)
certs, err := ioutil.ReadFile(filepath.Join(btcdHomeDir, "rpc.cert"))
if err != nil {
log.Fatal(err)
@ -1171,7 +1171,7 @@ func main() {
// Load the certificate for the TLS connection which is automatically
// generated by btcd when it starts the RPC server and doesn't already
// have one.
btcdHomeDir := btcutil.AppDataDir("btcd", false)
btcdHomeDir := btcutil.AppDataDir("chain", false)
certs, err := ioutil.ReadFile(filepath.Join(btcdHomeDir, "rpc.cert"))
if err != nil {
log.Fatal(err)
@ -1274,7 +1274,7 @@ func main() {
// Load the certificate for the TLS connection which is automatically
// generated by btcd when it starts the RPC server and doesn't already
// have one.
btcdHomeDir := btcutil.AppDataDir("btcd", false)
btcdHomeDir := btcutil.AppDataDir("chain", false)
certs, err := ioutil.ReadFile(filepath.Join(btcdHomeDir, "rpc.cert"))
if err != nil {
log.Fatal(err)

View file

@ -44,7 +44,7 @@ func btcdExecutablePath() (string, error) {
}
// Build btcd and output an executable in a static temp path.
outputPath := filepath.Join(testDir, "btcd")
outputPath := filepath.Join(testDir, "chain")
if runtime.GOOS == "windows" {
outputPath += ".exe"
}

View file

@ -51,7 +51,7 @@ func newConfig(prefix, certFile, keyFile string, extra []string,
var err error
btcdPath, err = btcdExecutablePath()
if err != nil {
btcdPath = "btcd"
btcdPath = "chain"
}
}

View file

@ -531,7 +531,7 @@ func generateListeningAddresses() (string, string) {
// baseDir is the directory path of the temp directory for all rpctest files.
func baseDir() (string, error) {
dirPath := filepath.Join(os.TempDir(), "btcd", "rpctest")
dirPath := filepath.Join(os.TempDir(), "chain", "rpctest")
err := os.MkdirAll(dirPath, 0755)
return dirPath, err
}

View file

@ -32,7 +32,7 @@ func main() {
}
// Connect to local btcd RPC server using websockets.
btcdHomeDir := btcutil.AppDataDir("btcd", false)
btcdHomeDir := btcutil.AppDataDir("chain", false)
certs, err := ioutil.ReadFile(filepath.Join(btcdHomeDir, "rpc.cert"))
if err != nil {
log.Fatal(err)

View file

@ -27,8 +27,8 @@ func main() {
},
}
// Connect to local btcwallet RPC server using websockets.
certHomeDir := btcutil.AppDataDir("btcwallet", false)
// Connect to local chainwallet RPC server using websockets.
certHomeDir := btcutil.AppDataDir("chainwallet", false)
certs, err := ioutil.ReadFile(filepath.Join(certHomeDir, "rpc.cert"))
if err != nil {
log.Fatal(err)

View file

@ -35,13 +35,13 @@ func oldBtcdHomeDir() string {
// Search for Windows APPDATA first. This won't exist on POSIX OSes.
appData := os.Getenv("APPDATA")
if appData != "" {
return filepath.Join(appData, "btcd")
return filepath.Join(appData, "chain")
}
// Fall back to standard HOME directory that works for most POSIX OSes.
home := os.Getenv("HOME")
if home != "" {
return filepath.Join(home, ".btcd")
return filepath.Join(home, ".chain")
}
// In the worst case, use the current directory.
@ -96,9 +96,9 @@ func upgradeDBPaths() error {
// respective networks. Check for the old database and update it to the
// new path introduced with version 0.2.0 accordingly.
oldDbRoot := filepath.Join(oldBtcdHomeDir(), "db")
upgradeDBPathNet(filepath.Join(oldDbRoot, "btcd.db"), "mainnet")
upgradeDBPathNet(filepath.Join(oldDbRoot, "btcd_testnet.db"), "testnet")
upgradeDBPathNet(filepath.Join(oldDbRoot, "btcd_regtest.db"), "regtest")
upgradeDBPathNet(filepath.Join(oldDbRoot, "chain.db"), "mainnet")
upgradeDBPathNet(filepath.Join(oldDbRoot, "chain_testnet.db"), "testnet")
upgradeDBPathNet(filepath.Join(oldDbRoot, "chain_regtest.db"), "regtest")
// Remove the old db directory.
return os.RemoveAll(oldDbRoot)