From 6d1e8e861943420776322d90c6a63a63ada9e623 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Mon, 8 Dec 2025 15:54:37 +0000 Subject: [PATCH] lnworker: write rationale for PaymentInfo class in docstring ref https://github.com/spesmilo/electrum/commit/4ad9caddab3fe5d3b25fc53d7ffa7ccf5cbd3b6c ref https://github.com/spesmilo/electrum/commit/f08e5541aeda9524eb456477f93732de7357c792 --- electrum/lnworker.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/electrum/lnworker.py b/electrum/lnworker.py index 2d32d7fe1..c49aa3dfc 100644 --- a/electrum/lnworker.py +++ b/electrum/lnworker.py @@ -118,7 +118,15 @@ class PaymentDirection(IntEnum): @dataclasses.dataclass(frozen=True, kw_only=True) class PaymentInfo: - """Information required to handle incoming htlcs for a payment request""" + """Information required to handle incoming htlcs for a payment request. + + - Historically, we used to store "bolt11, direction, status", but deserializing bolt11 was too slow. + (even deserializing just once - all bolt11 during wallet-open - was slow) + - note: the deserialization code in lnaddr.py has been significantly sped up since + - For incoming payments, for unpaid requests, ~every time the user displays the unpaid bolt11, + we get a chance to display a new bolt11, with same payment_hash/amount, but with updated + routing_hints (channels might get closed/opened, or just liquidity changed drastically). + """ payment_hash: bytes amount_msat: Optional[int] direction: lnutil.Direction