mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-28 06:32:18 +02:00
lncfg: add new GetBackends which returns active DB backends
In this commit, we modify the existing `GetBackend` method to now be called `GetBackends`. This new method will populate a new `RemoteDB` attribute based on if the replicated backend is active or not. As is, the local backend is used everywhere. An upcoming commit will once again re-enable the remote backend, in a hybrid manner.
This commit is contained in:
7
lnd.go
7
lnd.go
@@ -251,6 +251,7 @@ func Main(cfg *Config, lisCfg ListenerCfg, shutdownChan <-chan struct{}) error {
|
||||
"minutes...")
|
||||
|
||||
startOpenTime := time.Now()
|
||||
|
||||
ctx := context.Background()
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
@@ -260,8 +261,8 @@ func Main(cfg *Config, lisCfg ListenerCfg, shutdownChan <-chan struct{}) error {
|
||||
cfg.DB.Bolt.SyncFreelist)
|
||||
}
|
||||
|
||||
chanDbBackend, err := cfg.DB.GetBackend(ctx,
|
||||
cfg.localDatabaseDir(), cfg.networkName(),
|
||||
databaseBackends, err := cfg.DB.GetBackends(
|
||||
ctx, cfg.localDatabaseDir(), cfg.networkName(),
|
||||
)
|
||||
if err != nil {
|
||||
ltndLog.Error(err)
|
||||
@@ -271,7 +272,7 @@ func Main(cfg *Config, lisCfg ListenerCfg, shutdownChan <-chan struct{}) error {
|
||||
// Open the channeldb, which is dedicated to storing channel, and
|
||||
// network related metadata.
|
||||
chanDB, err := channeldb.CreateWithBackend(
|
||||
chanDbBackend,
|
||||
databaseBackends.LocalDB,
|
||||
channeldb.OptionSetRejectCacheSize(cfg.Caches.RejectCacheSize),
|
||||
channeldb.OptionSetChannelCacheSize(cfg.Caches.ChannelCacheSize),
|
||||
channeldb.OptionDryRunMigration(cfg.DryRunMigration),
|
||||
|
Reference in New Issue
Block a user