@@ -105,7 +105,7 @@ type DatabaseBuilder interface {
105105type WalletConfigBuilder interface {
106106 // BuildWalletConfig is responsible for creating or unlocking and then
107107 // fully initializing a wallet.
108- BuildWalletConfig (context.Context , * DatabaseInstances ,
108+ BuildWalletConfig (context.Context , * DatabaseInstances , * AuxComponents ,
109109 * rpcperms.InterceptorChain ,
110110 []* ListenerWithSignal ) (* chainreg.PartialChainControl ,
111111 * btcwallet.Config , func (), error )
@@ -120,14 +120,6 @@ type ChainControlBuilder interface {
120120 * btcwallet.Config ) (* chainreg.ChainControl , func (), error )
121121}
122122
123- // AuxComponents is a set of auxiliary components that can be used by lnd for
124- // certain custom channel types.
125- type AuxComponents struct {
126- // MsgRouter is an optional message router that if set will be used in
127- // place of a new blank default message router.
128- MsgRouter fn.Option [msgmux.Router ]
129- }
130-
131123// ImplementationCfg is a struct that holds all configuration items for
132124// components that can be implemented outside lnd itself.
133125type ImplementationCfg struct {
@@ -160,6 +152,18 @@ type ImplementationCfg struct {
160152 AuxComponents
161153}
162154
155+ // AuxComponents is a set of auxiliary components that can be used by lnd for
156+ // certain custom channel types.
157+ type AuxComponents struct {
158+ // AuxLeafStore is an optional data source that can be used by custom
159+ // channels to fetch+store various data.
160+ AuxLeafStore fn.Option [lnwallet.AuxLeafStore ]
161+
162+ // MsgRouter is an optional message router that if set will be used in
163+ // place of a new blank default message router.
164+ MsgRouter fn.Option [msgmux.Router ]
165+ }
166+
163167// DefaultWalletImpl is the default implementation of our normal, btcwallet
164168// backed configuration.
165169type DefaultWalletImpl struct {
@@ -242,7 +246,8 @@ func (d *DefaultWalletImpl) Permissions() map[string][]bakery.Op {
242246//
243247// NOTE: This is part of the WalletConfigBuilder interface.
244248func (d * DefaultWalletImpl ) BuildWalletConfig (ctx context.Context ,
245- dbs * DatabaseInstances , interceptorChain * rpcperms.InterceptorChain ,
249+ dbs * DatabaseInstances , aux * AuxComponents ,
250+ interceptorChain * rpcperms.InterceptorChain ,
246251 grpcListeners []* ListenerWithSignal ) (* chainreg.PartialChainControl ,
247252 * btcwallet.Config , func (), error ) {
248253
@@ -562,6 +567,7 @@ func (d *DefaultWalletImpl) BuildWalletConfig(ctx context.Context,
562567 HeightHintDB : dbs .HeightHintDB ,
563568 ChanStateDB : dbs .ChanStateDB .ChannelStateDB (),
564569 NeutrinoCS : neutrinoCS ,
570+ AuxLeafStore : aux .AuxLeafStore ,
565571 ActiveNetParams : d .cfg .ActiveNetParams ,
566572 FeeURL : d .cfg .FeeURL ,
567573 Fee : & lncfg.Fee {
@@ -625,8 +631,9 @@ func (d *DefaultWalletImpl) BuildWalletConfig(ctx context.Context,
625631
626632// proxyBlockEpoch proxies a block epoch subsections to the underlying neutrino
627633// rebroadcaster client.
628- func proxyBlockEpoch (notifier chainntnfs.ChainNotifier ,
629- ) func () (* blockntfns.Subscription , error ) {
634+ func proxyBlockEpoch (
635+ notifier chainntnfs.ChainNotifier ) func () (* blockntfns.Subscription ,
636+ error ) {
630637
631638 return func () (* blockntfns.Subscription , error ) {
632639 blockEpoch , err := notifier .RegisterBlockEpochNtfn (
@@ -717,6 +724,7 @@ func (d *DefaultWalletImpl) BuildChainControl(
717724 ChainIO : walletController ,
718725 NetParams : * walletConfig .NetParams ,
719726 CoinSelectionStrategy : walletConfig .CoinSelectionStrategy ,
727+ AuxLeafStore : partialChainControl .Cfg .AuxLeafStore ,
720728 }
721729
722730 // The broadcast is already always active for neutrino nodes, so we
@@ -899,6 +907,10 @@ type DatabaseInstances struct {
899907 // for native SQL queries for tables that already support it. This may
900908 // be nil if the use-native-sql flag was not set.
901909 NativeSQLStore * sqldb.BaseDB
910+
911+ // AuxLeafStore is an optional data source that can be used by custom
912+ // channels to fetch+store various data.
913+ AuxLeafStore fn.Option [lnwallet.AuxLeafStore ]
902914}
903915
904916// DefaultDatabaseBuilder is a type that builds the default database backends
0 commit comments