+ #[test]
+ fn pays_invoice_on_partial_failure() {
+ let event_handler = |_: &_| { panic!() };
+
+ let payment_preimage = PaymentPreimage([1; 32]);
+ let invoice = invoice(payment_preimage);
+ let retry = TestRouter::retry_for_invoice(&invoice);
+ let final_value_msat = invoice.amount_milli_satoshis().unwrap();
+
+ let payer = TestPayer::new()
+ .fails_with_partial_failure(retry.clone(), OnAttempt(1))
+ .fails_with_partial_failure(retry, OnAttempt(2))
+ .expect_send(Amount::ForInvoice(final_value_msat))
+ .expect_send(Amount::OnRetry(final_value_msat / 2))
+ .expect_send(Amount::OnRetry(final_value_msat / 2));
+ let router = TestRouter {};
+ let scorer = RefCell::new(TestScorer::new());
+ let logger = TestLogger::new();
+ let invoice_payer =
+ InvoicePayer::new(&payer, router, &scorer, &logger, event_handler, RetryAttempts(2));
+
+ assert!(invoice_payer.pay_invoice(&invoice).is_ok());
+ }
+