Rewrite InvoicePayer retry to correctly handle MPP partial failures
authorMatt Corallo <git@bluematt.me>
Tue, 26 Oct 2021 22:52:06 +0000 (22:52 +0000)
committerMatt Corallo <git@bluematt.me>
Sun, 31 Oct 2021 17:43:26 +0000 (17:43 +0000)
commit7112661b109b79cdb8e174fdd3ab73c05386212c
tree44d44c592c43e1dc2abcc4493b59ed1bb8c14e21
parente9e8a7d58d3fd415ad1746b3fee5f332c78d72e9
Rewrite InvoicePayer retry to correctly handle MPP partial failures

This rewrites a good chunk of the retry logic in `InvoicePayer` to
address two issues:
 * it was not considering the return value of `send_payment` (and
   `retry_payment`) may indicate a failure on some paths but not
   others,
 * it was not considering that more failures may still come later
   when removing elements from the retry count map. This could
   result in us seeing an MPP-partial-failure, failing to retry,
   removing the retries count entry, and then retrying other parts,
   potentially forever.
lightning-invoice/src/payment.rs