Refactor InvoicePayer for spontaneous payments
authorJeffrey Czyz <jkczyz@gmail.com>
Tue, 9 Nov 2021 15:37:34 +0000 (09:37 -0600)
committerJeffrey Czyz <jkczyz@gmail.com>
Tue, 16 Nov 2021 19:57:25 +0000 (13:57 -0600)
commitc9ce344d56991ffa49c1867d5041bc136cedbece
tree925e1953ed5088ded2601f2b39dd15c11e4162ce
parentc0bbd4d91877b3f7eca5b6aba877257acf4eec0b
Refactor InvoicePayer for spontaneous payments

To support spontaneous payments, InvoicePayer's sending logic must be
invoice-agnostic. Refactor InvoicePayer::pay_invoice_internal such that
invoice-specific code is in pay_invoice_using_amount and the remaining
logic is in pay_internal.

Further refactor the code's payment_cache locking such that it is
accessed consistently when needed, and tidy up the code a bit.
lightning-invoice/src/payment.rs