diff --git a/chain_bridge.go b/chain_bridge.go index a554858aa..92cd6c806 100644 --- a/chain_bridge.go +++ b/chain_bridge.go @@ -18,6 +18,7 @@ import ( "github.com/lightninglabs/taproot-assets/tapgarden" "github.com/lightningnetwork/lnd/chainntnfs" "github.com/lightningnetwork/lnd/funding" + "github.com/lightningnetwork/lnd/lnrpc/routerrpc" "github.com/lightningnetwork/lnd/lnwallet/chainfee" "github.com/lightningnetwork/lnd/lnwire" "github.com/lightningnetwork/lnd/routing/route" @@ -376,9 +377,17 @@ func (l *LndRouterClient) DeleteLocalAlias(ctx context.Context, alias, return l.lnd.Router.XDeleteLocalChanAlias(ctx, alias, baseScid) } +func (l *LndRouterClient) SubscribeHtlcEvents( + ctx context.Context) (<-chan *routerrpc.HtlcEvent, + <-chan error, error) { + + return l.lnd.Router.SubscribeHtlcEvents(ctx) +} + // Ensure LndRouterClient implements the rfq.HtlcInterceptor interface. var _ rfq.HtlcInterceptor = (*LndRouterClient)(nil) var _ rfq.ScidAliasManager = (*LndRouterClient)(nil) +var _ rfq.HtlcSubscriber = (*LndRouterClient)(nil) // LndInvoicesClient is an LND invoices RPC client. type LndInvoicesClient struct { diff --git a/rfq/manager.go b/rfq/manager.go index 7bc589cd1..34e205518 100644 --- a/rfq/manager.go +++ b/rfq/manager.go @@ -72,6 +72,10 @@ type ManagerCfg struct { // intercept and accept/reject HTLCs. HtlcInterceptor HtlcInterceptor + // HtlcSubscriber is a subscriber that is used to retrieve live HTLC + // event updates. + HtlcSubscriber HtlcSubscriber + // PriceOracle is the price oracle that the RFQ manager will use to // determine whether a quote is accepted or rejected. PriceOracle PriceOracle @@ -207,6 +211,7 @@ func (m *Manager) startSubsystems(ctx context.Context) error { m.orderHandler, err = NewOrderHandler(OrderHandlerCfg{ CleanupInterval: CacheCleanupInterval, HtlcInterceptor: m.cfg.HtlcInterceptor, + HtlcSubscriber: m.cfg.HtlcSubscriber, AcceptHtlcEvents: m.acceptHtlcEvents, }) if err != nil { diff --git a/rfq/order.go b/rfq/order.go index a897a7094..035bd91fa 100644 --- a/rfq/order.go +++ b/rfq/order.go @@ -14,6 +14,7 @@ import ( "github.com/lightninglabs/taproot-assets/rfqmath" "github.com/lightninglabs/taproot-assets/rfqmsg" "github.com/lightningnetwork/lnd/input" + "github.com/lightningnetwork/lnd/lnrpc/routerrpc" "github.com/lightningnetwork/lnd/lnutils" "github.com/lightningnetwork/lnd/lnwallet" "github.com/lightningnetwork/lnd/lnwire" @@ -843,3 +844,10 @@ type HtlcInterceptor interface { // to respond to HTLCs. InterceptHtlcs(context.Context, lndclient.HtlcInterceptHandler) error } + +// HtlcSubscriber is an interface that contains the function necessary for +// retrieving live HTLC event updates. +type HtlcSubscriber interface { + SubscribeHtlcEvents(ctx context.Context) (<-chan *routerrpc.HtlcEvent, + <-chan error, error) +} diff --git a/tapcfg/server.go b/tapcfg/server.go index f668a2360..c3204177f 100644 --- a/tapcfg/server.go +++ b/tapcfg/server.go @@ -395,6 +395,7 @@ func genServerConfig(cfg *Config, cfgLogger btclog.Logger, rfq.ManagerCfg{ PeerMessenger: msgTransportClient, HtlcInterceptor: lndRouterClient, + HtlcSubscriber: lndRouterClient, PriceOracle: priceOracle, ChannelLister: walletAnchor, AliasManager: lndRouterClient,