htlcswitch: obtain the min final CLTV delta directly from the InvoiceDatabase
In this commit, we modify the existing logic that would attempt to read the min CLTV information from the invoice directly. With this route, we avoid any sort of DB index modifications, as this information is already stored within the payment request, which is already available to the outside callers. By modifying the InvoiceDatabase interface, we avoid having to make the switch aware of what the "primary" chain is.
This commit is contained in:
6 files changed
+72
-54
No files matched your search
+3
-2
@@ -2167,7 +2167,9 @@ func (l *channelLink) processRemoteAdds(fwdPkg *channeldb.FwdPkg,
|
||||
// we attempt to see if we have an invoice locally
|
||||
// which'll allow us to settle this htlc.
|
||||
invoiceHash := chainhash.Hash(pd.RHash)
|
||||
invoice, err := l.cfg.Registry.LookupInvoice(invoiceHash)
|
||||
invoice, minCltvDelta, err := l.cfg.Registry.LookupInvoice(
|
||||
invoiceHash,
|
||||
)
|
||||
if err != nil {
|
||||
log.Errorf("unable to query invoice registry: "+
|
||||
" %v", err)
|
||||
@@ -2258,7 +2260,6 @@ func (l *channelLink) processRemoteAdds(fwdPkg *channeldb.FwdPkg,
|
||||
|
||||
// We'll also ensure that our time-lock value has been
|
||||
// computed correctly.
|
||||
minCltvDelta := uint32(invoice.Terms.FinalCltvDelta)
|
||||
expectedHeight := heightNow + minCltvDelta
|
||||
switch {
|
||||
|
||||
|
||||
Reference in new issue
Block a user