@@ -34,6 +34,7 @@ import (
3434 "github.com/lightningnetwork/lnd/chainreg"
3535 "github.com/lightningnetwork/lnd/channeldb"
3636 "github.com/lightningnetwork/lnd/clock"
37+ "github.com/lightningnetwork/lnd/fn"
3738 "github.com/lightningnetwork/lnd/invoices"
3839 "github.com/lightningnetwork/lnd/keychain"
3940 "github.com/lightningnetwork/lnd/kvdb"
@@ -104,7 +105,7 @@ type DatabaseBuilder interface {
104105type WalletConfigBuilder interface {
105106 // BuildWalletConfig is responsible for creating or unlocking and then
106107 // fully initializing a wallet.
107- BuildWalletConfig (context.Context , * DatabaseInstances ,
108+ BuildWalletConfig (context.Context , * DatabaseInstances , * AuxComponents ,
108109 * rpcperms.InterceptorChain ,
109110 []* ListenerWithSignal ) (* chainreg.PartialChainControl ,
110111 * btcwallet.Config , func (), error )
@@ -145,6 +146,17 @@ type ImplementationCfg struct {
145146 // ChainControlBuilder is a type that can provide a custom wallet
146147 // implementation.
147148 ChainControlBuilder
149+ // AuxComponents is a set of auxiliary components that can be used by
150+ // lnd for certain custom channel types.
151+ AuxComponents
152+ }
153+
154+ // AuxComponents is a set of auxiliary components that can be used by lnd for
155+ // certain custom channel types.
156+ type AuxComponents struct {
157+ // AuxLeafStore is an optional data source that can be used by custom
158+ // channels to fetch+store various data.
159+ AuxLeafStore fn.Option [lnwallet.AuxLeafStore ]
148160}
149161
150162// DefaultWalletImpl is the default implementation of our normal, btcwallet
@@ -229,7 +241,8 @@ func (d *DefaultWalletImpl) Permissions() map[string][]bakery.Op {
229241//
230242// NOTE: This is part of the WalletConfigBuilder interface.
231243func (d * DefaultWalletImpl ) BuildWalletConfig (ctx context.Context ,
232- dbs * DatabaseInstances , interceptorChain * rpcperms.InterceptorChain ,
244+ dbs * DatabaseInstances , aux * AuxComponents ,
245+ interceptorChain * rpcperms.InterceptorChain ,
233246 grpcListeners []* ListenerWithSignal ) (* chainreg.PartialChainControl ,
234247 * btcwallet.Config , func (), error ) {
235248
@@ -549,6 +562,7 @@ func (d *DefaultWalletImpl) BuildWalletConfig(ctx context.Context,
549562 HeightHintDB : dbs .HeightHintDB ,
550563 ChanStateDB : dbs .ChanStateDB .ChannelStateDB (),
551564 NeutrinoCS : neutrinoCS ,
565+ AuxLeafStore : aux .AuxLeafStore ,
552566 ActiveNetParams : d .cfg .ActiveNetParams ,
553567 FeeURL : d .cfg .FeeURL ,
554568 Dialer : func (addr string ) (net.Conn , error ) {
@@ -607,8 +621,9 @@ func (d *DefaultWalletImpl) BuildWalletConfig(ctx context.Context,
607621
608622// proxyBlockEpoch proxies a block epoch subsections to the underlying neutrino
609623// rebroadcaster client.
610- func proxyBlockEpoch (notifier chainntnfs.ChainNotifier ,
611- ) func () (* blockntfns.Subscription , error ) {
624+ func proxyBlockEpoch (
625+ notifier chainntnfs.ChainNotifier ) func () (* blockntfns.Subscription ,
626+ error ) {
612627
613628 return func () (* blockntfns.Subscription , error ) {
614629 blockEpoch , err := notifier .RegisterBlockEpochNtfn (
@@ -699,6 +714,7 @@ func (d *DefaultWalletImpl) BuildChainControl(
699714 ChainIO : walletController ,
700715 NetParams : * walletConfig .NetParams ,
701716 CoinSelectionStrategy : walletConfig .CoinSelectionStrategy ,
717+ AuxLeafStore : partialChainControl .Cfg .AuxLeafStore ,
702718 }
703719
704720 // The broadcast is already always active for neutrino nodes, so we
@@ -878,6 +894,10 @@ type DatabaseInstances struct {
878894 // for native SQL queries for tables that already support it. This may
879895 // be nil if the use-native-sql flag was not set.
880896 NativeSQLStore * sqldb.BaseDB
897+
898+ // AuxLeafStore is an optional data source that can be used by custom
899+ // channels to fetch+store various data.
900+ AuxLeafStore fn.Option [lnwallet.AuxLeafStore ]
881901}
882902
883903// DefaultDatabaseBuilder is a type that builds the default database backends
0 commit comments