chainregistry: move neutrino database to chain dir
This commit is contained in:
parent
6286a93cf5
commit
d0afac0407
@ -149,8 +149,17 @@ func newChainControlFromConfig(cfg *config, chanDB *channeldb.DB,
|
|||||||
switch homeChainConfig.Node {
|
switch homeChainConfig.Node {
|
||||||
case "neutrino":
|
case "neutrino":
|
||||||
// First we'll open the database file for neutrino, creating
|
// First we'll open the database file for neutrino, creating
|
||||||
// the database if needed.
|
// the database if needed. We append the normalized network name
|
||||||
dbName := filepath.Join(cfg.DataDir, "neutrino.db")
|
// here to match the behavior of btcwallet.
|
||||||
|
neutrinoDbPath := filepath.Join(homeChainConfig.ChainDir,
|
||||||
|
normalizeNetwork(activeNetParams.Name))
|
||||||
|
|
||||||
|
// Ensure that the neutrino db path exists.
|
||||||
|
if err := os.MkdirAll(neutrinoDbPath, 0700); err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
dbName := filepath.Join(neutrinoDbPath, "neutrino.db")
|
||||||
nodeDatabase, err := walletdb.Create("bdb", dbName)
|
nodeDatabase, err := walletdb.Create("bdb", dbName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
@ -160,7 +169,7 @@ func newChainControlFromConfig(cfg *config, chanDB *channeldb.DB,
|
|||||||
// neutrino light client. We pass in relevant configuration
|
// neutrino light client. We pass in relevant configuration
|
||||||
// parameters required.
|
// parameters required.
|
||||||
config := neutrino.Config{
|
config := neutrino.Config{
|
||||||
DataDir: cfg.DataDir,
|
DataDir: neutrinoDbPath,
|
||||||
Database: nodeDatabase,
|
Database: nodeDatabase,
|
||||||
ChainParams: *activeNetParams.Params,
|
ChainParams: *activeNetParams.Params,
|
||||||
AddPeers: cfg.NeutrinoMode.AddPeers,
|
AddPeers: cfg.NeutrinoMode.AddPeers,
|
||||||
|
Loading…
Reference in New Issue
Block a user