diff --git a/electrum/lnworker.py b/electrum/lnworker.py index 1d799de38..fa28cf56d 100644 --- a/electrum/lnworker.py +++ b/electrum/lnworker.py @@ -2269,11 +2269,20 @@ class LNWallet(LNWorker): htlc: UpdateAddHtlc, expected_msat: int, ) -> RecvMPPResolution: + """Returns the status of the incoming htlc set the given *htlc* belongs to. + + ACCEPTED simply means the mpp set is complete, and we can proceed with further + checks before fulfilling (or failing) the htlcs. + In particular, note that hold-invoice-htlcs typically remain in the ACCEPTED state + for quite some time -- not in the "WAITING" state (which would refer to the mpp set + not yet being complete!). + """ payment_hash = htlc.payment_hash payment_key = payment_hash + payment_secret self.update_mpp_with_received_htlc( payment_key=payment_key, scid=short_channel_id, htlc=htlc, expected_msat=expected_msat) mpp_resolution = self.received_mpp_htlcs[payment_key].resolution + # if still waiting, calc resolution now: if mpp_resolution == RecvMPPResolution.WAITING: bundle = self.get_payment_bundle(payment_key) if bundle: @@ -2290,7 +2299,7 @@ class LNWallet(LNWorker): mpp_resolution = RecvMPPResolution.ACCEPTED elif time.time() - first_timestamp > self.MPP_EXPIRY: mpp_resolution = RecvMPPResolution.EXPIRED - + # save resolution, if any. if mpp_resolution != RecvMPPResolution.WAITING: for pkey in payment_keys: if pkey in self.received_mpp_htlcs: