rpcserver+routerrpc: add subscribe events to router backend

Add SubscribeHtlcEvents to RouterBackend in preparation for the
addition of a HtlcNotifier stream.
This commit is contained in:
carla 2020-03-13 09:30:16 +02:00
parent 4cb518c174
commit 67d4bad73f
No known key found for this signature in database
GPG Key ID: 4CA7FE54A6213C91
2 changed files with 6 additions and 0 deletions

@ -20,6 +20,7 @@ import (
"github.com/lightningnetwork/lnd/record" "github.com/lightningnetwork/lnd/record"
"github.com/lightningnetwork/lnd/routing" "github.com/lightningnetwork/lnd/routing"
"github.com/lightningnetwork/lnd/routing/route" "github.com/lightningnetwork/lnd/routing/route"
"github.com/lightningnetwork/lnd/subscribe"
"github.com/lightningnetwork/lnd/zpay32" "github.com/lightningnetwork/lnd/zpay32"
) )
@ -68,6 +69,10 @@ type RouterBackend struct {
// DefaultFinalCltvDelta is the default value used as final cltv delta // DefaultFinalCltvDelta is the default value used as final cltv delta
// when an RPC caller doesn't specify a value. // when an RPC caller doesn't specify a value.
DefaultFinalCltvDelta uint16 DefaultFinalCltvDelta uint16
// SubscribeHtlcEvents returns a subscription client for the node's
// htlc events.
SubscribeHtlcEvents func() (*subscribe.Client, error)
} }
// MissionControl defines the mission control dependencies of routerrpc. // MissionControl defines the mission control dependencies of routerrpc.

@ -567,6 +567,7 @@ func newRPCServer(s *server, macService *macaroons.Service,
Tower: s.controlTower, Tower: s.controlTower,
MaxTotalTimelock: cfg.MaxOutgoingCltvExpiry, MaxTotalTimelock: cfg.MaxOutgoingCltvExpiry,
DefaultFinalCltvDelta: uint16(cfg.Bitcoin.TimeLockDelta), DefaultFinalCltvDelta: uint16(cfg.Bitcoin.TimeLockDelta),
SubscribeHtlcEvents: s.htlcNotifier.SubscribeHtlcEvents,
} }
genInvoiceFeatures := func() *lnwire.FeatureVector { genInvoiceFeatures := func() *lnwire.FeatureVector {