mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-01 11:00:51 +02:00
Merge pull request #5206 from carlaKC/4987-heightexpirywatcher
invoices: add height based expiry watcher
This commit is contained in:
15
server.go
15
server.go
@ -443,11 +443,6 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
|
||||
readPool: readPool,
|
||||
chansToRestore: chansToRestore,
|
||||
|
||||
invoices: invoices.NewRegistry(
|
||||
remoteChanDB, invoices.NewInvoiceExpiryWatcher(clock.NewDefaultClock()),
|
||||
®istryConfig,
|
||||
),
|
||||
|
||||
channelNotifier: channelnotifier.New(remoteChanDB),
|
||||
|
||||
identityECDH: nodeKeyECDH,
|
||||
@ -484,11 +479,19 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
|
||||
subscribers: make(map[uint64]*preimageSubscriber),
|
||||
}
|
||||
|
||||
_, currentHeight, err := s.cc.ChainIO.GetBestBlock()
|
||||
currentHash, currentHeight, err := s.cc.ChainIO.GetBestBlock()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
expiryWatcher := invoices.NewInvoiceExpiryWatcher(
|
||||
clock.NewDefaultClock(), cfg.Invoices.HoldExpiryDelta,
|
||||
uint32(currentHeight), currentHash, cc.ChainNotifier,
|
||||
)
|
||||
s.invoices = invoices.NewRegistry(
|
||||
remoteChanDB, expiryWatcher, ®istryConfig,
|
||||
)
|
||||
|
||||
s.htlcNotifier = htlcswitch.NewHtlcNotifier(time.Now)
|
||||
|
||||
s.htlcSwitch, err = htlcswitch.New(htlcswitch.Config{
|
||||
|
Reference in New Issue
Block a user