mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-27 14:11:04 +02:00
chainntnfs: move cache implementation to channeldb
This commit moves the `HeightHintCache` implementation to the `channeldb` package and inverts the dependency relation between `chainntnfs` and `channeldb`. Many packages depend on channeldb for type definitions, interfaces, etc. `chainntnfs` is an example of that. `chainntnfs` defines the `SpendHintCache` and `ConfirmHintCache` interfaces but it also implments them (`HeightHintCache` struct). The implementation uses logic that should not leak from channeldb (ex: bucket paths). This makes our code highly coupled + it would not allow us to use any of these interfaces in a package that is imported by `channeldb` (circular dependency).
This commit is contained in:
@@ -292,7 +292,7 @@ func NewPartialChainControl(cfg *Config) (*PartialChainControl, func(), error) {
|
||||
}
|
||||
|
||||
var err error
|
||||
heightHintCacheConfig := chainntnfs.CacheConfig{
|
||||
heightHintCacheConfig := channeldb.CacheConfig{
|
||||
QueryDisable: cfg.HeightHintCacheQueryDisable,
|
||||
}
|
||||
if cfg.HeightHintCacheQueryDisable {
|
||||
@@ -300,7 +300,7 @@ func NewPartialChainControl(cfg *Config) (*PartialChainControl, func(), error) {
|
||||
}
|
||||
|
||||
// Initialize the height hint cache within the chain directory.
|
||||
hintCache, err := chainntnfs.NewHeightHintCache(
|
||||
hintCache, err := channeldb.NewHeightHintCache(
|
||||
heightHintCacheConfig, cfg.HeightHintDB,
|
||||
)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user