Add a separate PaymentSendFailure for idempotency violation
[rust-lightning] / lightning / src / ln / payment_tests.rs
index a65da368709a77aa84147b86dc11e55ae367a558..d3146a6e68667f1426e2edf55f22f28c3ea782e3 100644 (file)
@@ -1275,7 +1275,7 @@ fn claimed_send_payment_idempotent() {
                        // payment_id, it should be rejected.
                        let send_result = nodes[0].node.send_payment(&route, second_payment_hash, &Some(second_payment_secret), payment_id);
                        match send_result {
-                               Err(PaymentSendFailure::ParameterError(APIError::RouteError { err: "Payment already in progress" })) => {},
+                               Err(PaymentSendFailure::DuplicatePayment) => {},
                                _ => panic!("Unexpected send result: {:?}", send_result),
                        }
 
@@ -1283,7 +1283,7 @@ fn claimed_send_payment_idempotent() {
                        // also be rejected.
                        let send_result = nodes[0].node.send_spontaneous_payment(&route, None, payment_id);
                        match send_result {
-                               Err(PaymentSendFailure::ParameterError(APIError::RouteError { err: "Payment already in progress" })) => {},
+                               Err(PaymentSendFailure::DuplicatePayment) => {},
                                _ => panic!("Unexpected send result: {:?}", send_result),
                        }
                }
@@ -1347,7 +1347,7 @@ fn abandoned_send_payment_idempotent() {
                        // payment_id, it should be rejected.
                        let send_result = nodes[0].node.send_payment(&route, second_payment_hash, &Some(second_payment_secret), payment_id);
                        match send_result {
-                               Err(PaymentSendFailure::ParameterError(APIError::RouteError { err: "Payment already in progress" })) => {},
+                               Err(PaymentSendFailure::DuplicatePayment) => {},
                                _ => panic!("Unexpected send result: {:?}", send_result),
                        }
 
@@ -1355,7 +1355,7 @@ fn abandoned_send_payment_idempotent() {
                        // also be rejected.
                        let send_result = nodes[0].node.send_spontaneous_payment(&route, None, payment_id);
                        match send_result {
-                               Err(PaymentSendFailure::ParameterError(APIError::RouteError { err: "Payment already in progress" })) => {},
+                               Err(PaymentSendFailure::DuplicatePayment) => {},
                                _ => panic!("Unexpected send result: {:?}", send_result),
                        }
                }