1
0

lnworker: enforce creation of PaymentInfo for b11

Enforce that the information used to create a bolt11 invoice using
`get_bolt11_invoice()` is similar to the related instance of PaymentInfo
by requiring a PaymentInfo as argument for `get_bolt11_invoice()`.
This way the invoice cannot differ from the created PaymentInfo.
This allows to use the information in PaymentInfo for validation of
incoming htlcs more reliably.

To cover all required information for the creation of a b11 invoice the
PaymentInfo class has to be extended with a expiry and
min_final_cltv_expiry. This requires a db upgrade.
This commit is contained in:
f321x
2025-09-26 16:11:20 +02:00
parent d62b627a0b
commit 286fc4b86e
9 changed files with 134 additions and 80 deletions

View File

@@ -2758,7 +2758,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener):
self.closing_warning_callbacks.append(warning_callback)
def _check_ongoing_force_closures(self) -> Optional[str]:
from electrum.lnutil import MIN_FINAL_CLTV_DELTA_FOR_INVOICE
from electrum.lnutil import MIN_FINAL_CLTV_DELTA_ACCEPTED
if not self.wallet.has_lightning():
return None
if not self.network:
@@ -2767,7 +2767,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger, QtEventListener):
if not force_closes:
return
# fixme: this is inaccurate, we need local_height - cltv_of_htlc
cltv_delta = MIN_FINAL_CLTV_DELTA_FOR_INVOICE
cltv_delta = MIN_FINAL_CLTV_DELTA_ACCEPTED
msg = '\n\n'.join([
_("Pending channel force-close"),
messages.MSG_FORCE_CLOSE_WARNING.format(cltv_delta),