X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Fonion_route_tests.rs;h=743d41eea1ba731ca96ac0114a443660fe1f1738;hb=f78e6b956c8cc89201831c9865416237b5ea9952;hp=fd181da395dab8cfbcf5d0e3b9f89d214d2fb947;hpb=a5ecb851716bc0819586894232653ec4b5e2c67f;p=rust-lightning diff --git a/lightning/src/ln/onion_route_tests.rs b/lightning/src/ln/onion_route_tests.rs index fd181da3..743d41ee 100644 --- a/lightning/src/ln/onion_route_tests.rs +++ b/lightning/src/ln/onion_route_tests.rs @@ -13,7 +13,7 @@ use crate::chain::channelmonitor::{CLTV_CLAIM_BUFFER, LATENCY_GRACE_PERIOD_BLOCKS}; use crate::chain::keysinterface::{EntropySource, NodeSigner, Recipient}; -use crate::events::{Event, HTLCDestination, MessageSendEvent, MessageSendEventsProvider, PathFailure}; +use crate::events::{Event, HTLCDestination, MessageSendEvent, MessageSendEventsProvider, PathFailure, PaymentFailureReason}; use crate::ln::{PaymentHash, PaymentSecret}; use crate::ln::channel::EXPIRE_PREV_CONFIG_TICKS; use crate::ln::channelmanager::{HTLCForwardInfo, FailureCode, CLTV_FAR_FAR_AWAY, MIN_CLTV_EXPIRY_DELTA, PendingAddHTLCInfo, PendingHTLCInfo, PendingHTLCRouting, PaymentId, RecipientOnionFields}; @@ -213,9 +213,14 @@ fn run_onion_failure_test_with_fail_intercept(_name: &str, test_case: panic!("Unexpected event"); } match events[1] { - Event::PaymentFailed { payment_hash: ev_payment_hash, payment_id: ev_payment_id } => { + Event::PaymentFailed { payment_hash: ev_payment_hash, payment_id: ev_payment_id, reason: ref ev_reason } => { assert_eq!(*payment_hash, ev_payment_hash); assert_eq!(payment_id, ev_payment_id); + assert_eq!(if expected_retryable { + PaymentFailureReason::RetriesExhausted + } else { + PaymentFailureReason::RecipientRejected + }, ev_reason.unwrap()); } _ => panic!("Unexpected second event"), }