Merge pull request #5206 from carlaKC/4987-heightexpirywatcher
invoices: add height based expiry watcher
This commit is contained in:
13 files changed
+819
-87
No files matched your search
@@ -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