Use `Event::PaymentFailed` in `InvoicePayer` to remove retry count
authorMatt Corallo <git@bluematt.me>
Sat, 4 Dec 2021 23:41:37 +0000 (23:41 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 15 Dec 2021 03:57:13 +0000 (03:57 +0000)
commit3086bd8c8e3f4c1d2c5fa99279f516817ce05587
treeed8c6ccf9d034c0bd8ce06225c1697dc6a715b43
parent7782d0a1ef9fb4e9d26f78a042da16939708d697
Use `Event::PaymentFailed` in `InvoicePayer` to remove retry count

This finally fixes the bug described in the previous commits where
we retry a payment after its retry count has expired due to early
removal of the payment from the retry count tracking map. A test is
also added which demonstrates the bug in previous versions and
which passes now.

Fixes #1164.
lightning-invoice/src/payment.rs
lightning-invoice/src/utils.rs