Skip to content

Commit 1ef18d9

Browse files
committed
Expose hold times in the PaymentPathFailed event during test
1 parent 6be1634 commit 1ef18d9

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

lightning-background-processor/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2699,6 +2699,7 @@ mod tests {
26992699
short_channel_id: Some(scored_scid),
27002700
error_code: None,
27012701
error_data: None,
2702+
hold_times: Vec::new(),
27022703
});
27032704
let event = $receive.expect("PaymentPathFailed not handled within deadline");
27042705
match event {
@@ -2718,6 +2719,7 @@ mod tests {
27182719
short_channel_id: None,
27192720
error_code: None,
27202721
error_data: None,
2722+
hold_times: Vec::new(),
27212723
});
27222724
let event = $receive.expect("PaymentPathFailed not handled within deadline");
27232725
match event {

lightning/src/events/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,6 +1131,8 @@ pub enum Event {
11311131
error_code: Option<u16>,
11321132
#[cfg(any(test, feature = "_test_utils"))]
11331133
error_data: Option<Vec<u8>>,
1134+
#[cfg(any(test, feature = "_test_utils"))]
1135+
hold_times: Vec<u32>,
11341136
},
11351137
/// Indicates that a probe payment we sent returned successful, i.e., only failed at the destination.
11361138
///
@@ -1696,12 +1698,16 @@ impl Writeable for Event {
16961698
ref error_code,
16971699
#[cfg(any(test, feature = "_test_utils"))]
16981700
ref error_data,
1701+
#[cfg(any(test, feature = "_test_utils"))]
1702+
ref hold_times,
16991703
} => {
17001704
3u8.write(writer)?;
17011705
#[cfg(any(test, feature = "_test_utils"))]
17021706
error_code.write(writer)?;
17031707
#[cfg(any(test, feature = "_test_utils"))]
17041708
error_data.write(writer)?;
1709+
#[cfg(any(test, feature = "_test_utils"))]
1710+
hold_times.write(writer)?;
17051711
write_tlv_fields!(writer, {
17061712
(0, payment_hash, required),
17071713
(1, None::<NetworkUpdate>, option), // network_update in LDK versions prior to 0.0.114
@@ -2121,6 +2127,8 @@ impl MaybeReadable for Event {
21212127
let error_code = Readable::read(reader)?;
21222128
#[cfg(any(test, feature = "_test_utils"))]
21232129
let error_data = Readable::read(reader)?;
2130+
#[cfg(any(test, feature = "_test_utils"))]
2131+
let hold_times = Readable::read(reader)?;
21242132
let mut payment_hash = PaymentHash([0; 32]);
21252133
let mut payment_failed_permanently = false;
21262134
let mut network_update = None;
@@ -2154,6 +2162,8 @@ impl MaybeReadable for Event {
21542162
error_code,
21552163
#[cfg(any(test, feature = "_test_utils"))]
21562164
error_data,
2165+
#[cfg(any(test, feature = "_test_utils"))]
2166+
hold_times,
21572167
}))
21582168
};
21592169
f()

lightning/src/ln/outbound_payment.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1644,6 +1644,8 @@ impl OutboundPayments {
16441644
error_code: None,
16451645
#[cfg(any(test, feature = "_test_utils"))]
16461646
error_data: None,
1647+
#[cfg(any(test, feature = "_test_utils"))]
1648+
hold_times: Vec::new(),
16471649
}, None));
16481650
}
16491651
}
@@ -2263,7 +2265,7 @@ impl OutboundPayments {
22632265
#[cfg(any(test, feature = "_test_utils"))]
22642266
let DecodedOnionFailure {
22652267
network_update, short_channel_id, payment_failed_permanently, onion_error_code,
2266-
onion_error_data, failed_within_blinded_path, ..
2268+
onion_error_data, failed_within_blinded_path, hold_times, ..
22672269
} = onion_error.decode_onion_failure(secp_ctx, logger, &source);
22682270
#[cfg(not(any(test, feature = "_test_utils")))]
22692271
let DecodedOnionFailure {
@@ -2376,7 +2378,9 @@ impl OutboundPayments {
23762378
#[cfg(any(test, feature = "_test_utils"))]
23772379
error_code: onion_error_code.map(|f| f.failure_code()),
23782380
#[cfg(any(test, feature = "_test_utils"))]
2379-
error_data: onion_error_data
2381+
error_data: onion_error_data,
2382+
#[cfg(any(test, feature = "_test_utils"))]
2383+
hold_times,
23802384
}
23812385
}
23822386
};

lightning/src/util/ser.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,6 +1089,7 @@ impl_readable_for_vec!(crate::routing::router::BlindedTail);
10891089
impl_for_vec!(crate::routing::router::TrampolineHop);
10901090
impl_for_vec_with_element_length_prefix!(crate::ln::msgs::UpdateAddHTLC);
10911091
impl_writeable_for_vec_with_element_length_prefix!(&crate::ln::msgs::UpdateAddHTLC);
1092+
impl_for_vec!(u32);
10921093

10931094
impl Writeable for Vec<Witness> {
10941095
#[inline]

0 commit comments

Comments
 (0)