multi: rename local and remote chan DBs

As a preparation to not have a local and remote version of the database
around anymore, we rename the variables into what their actual function
is. In case of the RPC server we even directly use the channel graph
instead of the DB instance. This should allow us to extract the channel
graph into its own, separate database (perhaps with better access
characteristics) in the future.
This commit is contained in:
Oliver Gugger
2021-08-03 09:57:26 +02:00
parent abf3942228
commit 9138c8abac
10 changed files with 149 additions and 153 deletions

View File

@@ -68,11 +68,13 @@ type Config struct {
// LtcdMode defines settings for connecting to an ltcd node.
LtcdMode *lncfg.Btcd
// LocalChanDB is a pointer to the local backing channel database.
LocalChanDB *channeldb.DB
// HeightHintDB is a pointer to the database that stores the height
// hints.
HeightHintDB *channeldb.DB
// RemoteChanDB is a pointer to the remote backing channel database.
RemoteChanDB *channeldb.DB
// ChanStateDB is a pointer to the database that stores the channel
// state.
ChanStateDB *channeldb.DB
// BlockCacheSize is the size (in bytes) of blocks kept in memory.
BlockCacheSize uint64
@@ -304,7 +306,7 @@ func NewChainControl(cfg *Config, blockCache *blockcache.BlockCache) (
// Initialize the height hint cache within the chain directory.
hintCache, err := chainntnfs.NewHeightHintCache(
heightHintCacheConfig, cfg.LocalChanDB,
heightHintCacheConfig, cfg.HeightHintDB,
)
if err != nil {
return nil, nil, fmt.Errorf("unable to initialize height hint "+
@@ -684,7 +686,7 @@ func NewChainControl(cfg *Config, blockCache *blockcache.BlockCache) (
// Create, and start the lnwallet, which handles the core payment
// channel logic, and exposes control via proxy state machines.
walletCfg := lnwallet.Config{
Database: cfg.RemoteChanDB,
Database: cfg.ChanStateDB,
Notifier: cc.ChainNotifier,
WalletController: wc,
Signer: cc.Signer,