diff --git a/pickhardt-payments/src/main/java/de/cotto/lndmanagej/pickhardtpayments/PaymentLoop.java b/pickhardt-payments/src/main/java/de/cotto/lndmanagej/pickhardtpayments/PaymentLoop.java index c22c3054..0753ad29 100644 --- a/pickhardt-payments/src/main/java/de/cotto/lndmanagej/pickhardtpayments/PaymentLoop.java +++ b/pickhardt-payments/src/main/java/de/cotto/lndmanagej/pickhardtpayments/PaymentLoop.java @@ -67,7 +67,7 @@ public void start( if (paymentStatus.isFailure() && decodedPaymentRequest.destination().equals(ownPubkey)) { grpcInvoices.cancelPaymentRequest(decodedPaymentRequest); } - if (paymentStatus.isPending() || paymentStatus.isFailure()) { + if (paymentStatus.isFailure()) { grpcSendToRoute.forceFailureForPayment(decodedPaymentRequest); } } @@ -103,7 +103,7 @@ private void start() { loopIterationCounter++; Coins residualAmount = totalAmountToSend.subtract(inFlight); if (Coins.NONE.equals(residualAmount)) { - paymentStatus.info(TIMEOUT_MESSAGE); + paymentStatus.failed(TIMEOUT_MESSAGE); return; } if (shouldAbort(loopIterationCounter)) { diff --git a/pickhardt-payments/src/test/java/de/cotto/lndmanagej/pickhardtpayments/PaymentLoopTest.java b/pickhardt-payments/src/test/java/de/cotto/lndmanagej/pickhardtpayments/PaymentLoopTest.java index bf6949c8..f507aa2a 100644 --- a/pickhardt-payments/src/test/java/de/cotto/lndmanagej/pickhardtpayments/PaymentLoopTest.java +++ b/pickhardt-payments/src/test/java/de/cotto/lndmanagej/pickhardtpayments/PaymentLoopTest.java @@ -265,10 +265,8 @@ void aborts_for_stuck_pending_amount() { .thenReturn(Coins.NONE) .thenReturn(DECODED_PAYMENT_REQUEST.amount()); paymentLoop.start(DECODED_PAYMENT_REQUEST, PAYMENT_OPTIONS, paymentStatus); - SoftAssertions softly = new SoftAssertions(); - softly.assertThat(paymentStatus.isSuccess()).isFalse(); - softly.assertThat(paymentStatus.isFailure()).isFalse(); - softly.assertAll(); + // it's not strictly a failure, but we need to complete the flux/stream (see #88) + assertThat(paymentStatus.isFailure()).isTrue(); verify(grpcSendToRoute).forceFailureForPayment(DECODED_PAYMENT_REQUEST); }