Skip to content

Commit f098572

Browse files
committed
Track the amount spent on fees as payments are retried
Especially once we merge the `InvoicePayer` logic soon, we'll want to expose the total fee paid in the `PaymentSent` event.
1 parent 2ed1ba6 commit f098572

7 files changed

+90
-42
lines changed

lightning/src/ln/chanmon_update_fail_tests.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ fn do_test_monitor_temporary_update_fail(disconnect_count: usize) {
304304
let events_3 = nodes[0].node.get_and_clear_pending_events();
305305
assert_eq!(events_3.len(), 1);
306306
match events_3[0] {
307-
Event::PaymentSent { ref payment_preimage, ref payment_hash } => {
307+
Event::PaymentSent { ref payment_preimage, ref payment_hash, .. } => {
308308
assert_eq!(*payment_preimage, payment_preimage_1);
309309
assert_eq!(*payment_hash, payment_hash_1);
310310
},
@@ -397,7 +397,7 @@ fn do_test_monitor_temporary_update_fail(disconnect_count: usize) {
397397
let events_3 = nodes[0].node.get_and_clear_pending_events();
398398
assert_eq!(events_3.len(), 1);
399399
match events_3[0] {
400-
Event::PaymentSent { ref payment_preimage, ref payment_hash } => {
400+
Event::PaymentSent { ref payment_preimage, ref payment_hash, .. } => {
401401
assert_eq!(*payment_preimage, payment_preimage_1);
402402
assert_eq!(*payment_hash, payment_hash_1);
403403
},
@@ -1399,7 +1399,7 @@ fn claim_while_disconnected_monitor_update_fail() {
13991399
let events = nodes[0].node.get_and_clear_pending_events();
14001400
assert_eq!(events.len(), 1);
14011401
match events[0] {
1402-
Event::PaymentSent { ref payment_preimage, ref payment_hash } => {
1402+
Event::PaymentSent { ref payment_preimage, ref payment_hash, .. } => {
14031403
assert_eq!(*payment_preimage, payment_preimage_1);
14041404
assert_eq!(*payment_hash, payment_hash_1);
14051405
},
@@ -1806,7 +1806,7 @@ fn monitor_update_claim_fail_no_response() {
18061806
let events = nodes[0].node.get_and_clear_pending_events();
18071807
assert_eq!(events.len(), 1);
18081808
match events[0] {
1809-
Event::PaymentSent { ref payment_preimage, ref payment_hash } => {
1809+
Event::PaymentSent { ref payment_preimage, ref payment_hash, .. } => {
18101810
assert_eq!(*payment_preimage, payment_preimage_1);
18111811
assert_eq!(*payment_hash, payment_hash_1);
18121812
},

lightning/src/ln/channelmanager.rs

+41-22
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,7 @@ pub(crate) enum PendingOutboundPayment {
436436
payment_hash: PaymentHash,
437437
payment_secret: Option<PaymentSecret>,
438438
pending_amt_msat: u64,
439+
pending_fee_msat: u64,
439440
/// The total payment amount across all paths, used to verify that a retry is not overpaying.
440441
total_msat: u64,
441442
/// Our best known block height at the time this payment was initiated.
@@ -462,6 +463,12 @@ impl PendingOutboundPayment {
462463
_ => false,
463464
}
464465
}
466+
fn get_total_fee_msat(&self) -> Option<u64> {
467+
match self {
468+
PendingOutboundPayment::Retryable { pending_fee_msat, .. } => Some(*pending_fee_msat),
469+
_ => None,
470+
}
471+
}
465472

466473
fn mark_fulfilled(&mut self) {
467474
let mut session_privs = HashSet::new();
@@ -475,7 +482,7 @@ impl PendingOutboundPayment {
475482
}
476483

477484
/// panics if part_amt_msat is None and !self.is_fulfilled
478-
fn remove(&mut self, session_priv: &[u8; 32], part_amt_msat: Option<u64>) -> bool {
485+
fn remove(&mut self, session_priv: &[u8; 32], part_amt_msat: Option<u64>, part_fee_msat: Option<u64>) -> bool {
479486
let remove_res = match self {
480487
PendingOutboundPayment::Legacy { session_privs } |
481488
PendingOutboundPayment::Retryable { session_privs, .. } |
@@ -484,14 +491,15 @@ impl PendingOutboundPayment {
484491
}
485492
};
486493
if remove_res {
487-
if let PendingOutboundPayment::Retryable { ref mut pending_amt_msat, .. } = self {
494+
if let PendingOutboundPayment::Retryable { ref mut pending_amt_msat, ref mut pending_fee_msat, .. } = self {
488495
*pending_amt_msat -= part_amt_msat.expect("We must only not provide an amount if the payment was already fulfilled");
496+
*pending_fee_msat -= part_fee_msat.expect("We must only not provide a fee if the payment was already fulfilled");
489497
}
490498
}
491499
remove_res
492500
}
493501

494-
fn insert(&mut self, session_priv: [u8; 32], part_amt_msat: u64) -> bool {
502+
fn insert(&mut self, session_priv: [u8; 32], part_amt_msat: u64, part_fee_msat: u64) -> bool {
495503
let insert_res = match self {
496504
PendingOutboundPayment::Legacy { session_privs } |
497505
PendingOutboundPayment::Retryable { session_privs, .. } => {
@@ -500,8 +508,9 @@ impl PendingOutboundPayment {
500508
PendingOutboundPayment::Fulfilled { .. } => false
501509
};
502510
if insert_res {
503-
if let PendingOutboundPayment::Retryable { ref mut pending_amt_msat, .. } = self {
511+
if let PendingOutboundPayment::Retryable { ref mut pending_amt_msat, ref mut pending_fee_msat, .. } = self {
504512
*pending_amt_msat += part_amt_msat;
513+
*pending_fee_msat += part_fee_msat;
505514
}
506515
}
507516
insert_res
@@ -2081,12 +2090,14 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
20812090
let payment = payment_entry.or_insert_with(|| PendingOutboundPayment::Retryable {
20822091
session_privs: HashSet::new(),
20832092
pending_amt_msat: 0,
2093+
pending_fee_msat: 0,
20842094
payment_hash: *payment_hash,
20852095
payment_secret: *payment_secret,
20862096
starting_block_height: self.best_block.read().unwrap().height(),
20872097
total_msat: total_value,
20882098
});
2089-
assert!(payment.insert(session_priv_bytes, path.last().unwrap().fee_msat));
2099+
assert!(payment.insert(session_priv_bytes, path.last().unwrap().fee_msat,
2100+
path.split_last().map(|(_, path_prefix)| path_prefix).unwrap_or(&[]).iter().map(|hop| hop.fee_msat).sum()));
20902101

20912102
send_res
20922103
} {
@@ -3108,7 +3119,8 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
31083119
let mut outbounds = self.pending_outbound_payments.lock().unwrap();
31093120
if let hash_map::Entry::Occupied(mut payment) = outbounds.entry(payment_id) {
31103121
let path_last_hop = path.last().expect("Outbound payments must have had a valid path");
3111-
if payment.get_mut().remove(&session_priv_bytes, Some(path_last_hop.fee_msat)) &&
3122+
if payment.get_mut().remove(&session_priv_bytes, Some(path_last_hop.fee_msat),
3123+
Some(path.split_last().map(|(_, path_prefix)| path_prefix).unwrap_or(&[]).iter().map(|hop| hop.fee_msat).sum())) &&
31123124
!payment.get().is_fulfilled()
31133125
{
31143126
let retry = if let Some(payee_data) = payee {
@@ -3165,7 +3177,9 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
31653177
let mut all_paths_failed = false;
31663178
let path_last_hop = path.last().expect("Outbound payments must have had a valid path");
31673179
if let hash_map::Entry::Occupied(mut payment) = outbounds.entry(payment_id) {
3168-
if !payment.get_mut().remove(&session_priv_bytes, Some(path_last_hop.fee_msat)) {
3180+
if !payment.get_mut().remove(&session_priv_bytes, Some(path_last_hop.fee_msat),
3181+
Some(path.split_last().map(|(_, path_prefix)| path_prefix).unwrap_or(&[]).iter().map(|hop| hop.fee_msat).sum()))
3182+
{
31693183
log_trace!(self.logger, "Received duplicative fail for HTLC with payment_hash {}", log_bytes!(payment_hash.0));
31703184
return;
31713185
}
@@ -3438,7 +3452,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
34383452
let mut outbounds = self.pending_outbound_payments.lock().unwrap();
34393453
if let hash_map::Entry::Occupied(mut payment) = outbounds.entry(payment_id) {
34403454
assert!(payment.get().is_fulfilled());
3441-
payment.get_mut().remove(&session_priv_bytes, None);
3455+
payment.get_mut().remove(&session_priv_bytes, None, None);
34423456
if payment.get().remaining_parts() == 0 {
34433457
payment.remove();
34443458
}
@@ -3454,8 +3468,9 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
34543468
let mut session_priv_bytes = [0; 32];
34553469
session_priv_bytes.copy_from_slice(&session_priv[..]);
34563470
let mut outbounds = self.pending_outbound_payments.lock().unwrap();
3457-
let found_payment = if let hash_map::Entry::Occupied(mut payment) = outbounds.entry(payment_id) {
3471+
if let hash_map::Entry::Occupied(mut payment) = outbounds.entry(payment_id) {
34583472
let found_payment = !payment.get().is_fulfilled();
3473+
let fee_paid_msat = payment.get().get_total_fee_msat();
34593474
payment.get_mut().mark_fulfilled();
34603475
if from_onchain {
34613476
// We currently immediately remove HTLCs which were fulfilled on-chain.
@@ -3464,21 +3479,22 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
34643479
// restart.
34653480
// TODO: We should have a second monitor event that informs us of payments
34663481
// irrevocably fulfilled.
3467-
payment.get_mut().remove(&session_priv_bytes, Some(path.last().unwrap().fee_msat));
3482+
payment.get_mut().remove(&session_priv_bytes, Some(path.last().unwrap().fee_msat),
3483+
Some(path.split_last().map(|(_, path_prefix)| path_prefix).unwrap_or(&[]).iter().map(|hop| hop.fee_msat).sum()));
34683484
if payment.get().remaining_parts() == 0 {
34693485
payment.remove();
34703486
}
34713487
}
3472-
found_payment
3473-
} else { false };
3474-
if found_payment {
3475-
let payment_hash = PaymentHash(Sha256::hash(&payment_preimage.0).into_inner());
3476-
self.pending_events.lock().unwrap().push(
3477-
events::Event::PaymentSent {
3478-
payment_preimage,
3479-
payment_hash: payment_hash
3480-
}
3481-
);
3488+
if found_payment {
3489+
let payment_hash = PaymentHash(Sha256::hash(&payment_preimage.0).into_inner());
3490+
self.pending_events.lock().unwrap().push(
3491+
events::Event::PaymentSent {
3492+
payment_preimage,
3493+
payment_hash: payment_hash,
3494+
fee_paid_msat,
3495+
}
3496+
);
3497+
}
34823498
} else {
34833499
log_trace!(self.logger, "Received duplicative fulfill for HTLC with payment_preimage {}", log_bytes!(payment_preimage.0));
34843500
}
@@ -5496,6 +5512,7 @@ impl_writeable_tlv_based_enum_upgradable!(PendingOutboundPayment,
54965512
(6, total_msat, required),
54975513
(8, pending_amt_msat, required),
54985514
(10, starting_block_height, required),
5515+
(12, pending_fee_msat, required),
54995516
},
55005517
);
55015518

@@ -5943,11 +5960,12 @@ impl<'a, Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref>
59435960
return Err(DecodeError::InvalidValue);
59445961
}
59455962
let path_amt = path.last().unwrap().fee_msat;
5963+
let path_fee = path.split_last().map(|(_, path_prefix)| path_prefix).unwrap_or(&[]).iter().map(|hop| hop.fee_msat).sum();
59465964
let mut session_priv_bytes = [0; 32];
59475965
session_priv_bytes[..].copy_from_slice(&session_priv[..]);
59485966
match pending_outbound_payments.as_mut().unwrap().entry(payment_id) {
59495967
hash_map::Entry::Occupied(mut entry) => {
5950-
let newly_added = entry.get_mut().insert(session_priv_bytes, path_amt);
5968+
let newly_added = entry.get_mut().insert(session_priv_bytes, path_amt, path_fee);
59515969
log_info!(args.logger, "{} a pending payment path for {} msat for session priv {} on an existing pending payment with payment hash {}",
59525970
if newly_added { "Added" } else { "Had" }, path_amt, log_bytes!(session_priv_bytes), log_bytes!(htlc.payment_hash.0));
59535971
},
@@ -5957,6 +5975,7 @@ impl<'a, Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref>
59575975
payment_hash: htlc.payment_hash,
59585976
payment_secret,
59595977
pending_amt_msat: path_amt,
5978+
pending_fee_msat: path_fee,
59605979
total_msat: path_amt,
59615980
starting_block_height: best_block_height,
59625981
});
@@ -6256,7 +6275,7 @@ mod tests {
62566275
// further events will be generated for subsequence path successes.
62576276
let events = nodes[0].node.get_and_clear_pending_events();
62586277
match events[0] {
6259-
Event::PaymentSent { payment_preimage: ref preimage, payment_hash: ref hash } => {
6278+
Event::PaymentSent { payment_preimage: ref preimage, payment_hash: ref hash, .. } => {
62606279
assert_eq!(payment_preimage, *preimage);
62616280
assert_eq!(our_payment_hash, *hash);
62626281
},

lightning/src/ln/functional_test_utils.rs

+12-2
Original file line numberDiff line numberDiff line change
@@ -1081,13 +1081,20 @@ macro_rules! expect_payment_received {
10811081

10821082
macro_rules! expect_payment_sent {
10831083
($node: expr, $expected_payment_preimage: expr) => {
1084+
expect_payment_sent!($node, $expected_payment_preimage, None::<u64>);
1085+
};
1086+
($node: expr, $expected_payment_preimage: expr, $expected_fee_msat_opt: expr) => {
10841087
let events = $node.node.get_and_clear_pending_events();
10851088
let expected_payment_hash = PaymentHash(Sha256::hash(&$expected_payment_preimage.0).into_inner());
10861089
assert_eq!(events.len(), 1);
10871090
match events[0] {
1088-
Event::PaymentSent { ref payment_preimage, ref payment_hash } => {
1091+
Event::PaymentSent { ref payment_preimage, ref payment_hash, ref fee_paid_msat } => {
10891092
assert_eq!($expected_payment_preimage, *payment_preimage);
10901093
assert_eq!(expected_payment_hash, *payment_hash);
1094+
assert!(fee_paid_msat.is_some());
1095+
if $expected_fee_msat_opt.is_some() {
1096+
assert_eq!(*fee_paid_msat, $expected_fee_msat_opt);
1097+
}
10911098
},
10921099
_ => panic!("Unexpected event"),
10931100
}
@@ -1237,7 +1244,7 @@ pub fn send_along_route<'a, 'b, 'c>(origin_node: &Node<'a, 'b, 'c>, route: Route
12371244
(our_payment_preimage, our_payment_hash, our_payment_secret, payment_id)
12381245
}
12391246

1240-
pub fn claim_payment_along_route<'a, 'b, 'c>(origin_node: &Node<'a, 'b, 'c>, expected_paths: &[&[&Node<'a, 'b, 'c>]], skip_last: bool, our_payment_preimage: PaymentPreimage) {
1247+
pub fn do_claim_payment_along_route<'a, 'b, 'c>(origin_node: &Node<'a, 'b, 'c>, expected_paths: &[&[&Node<'a, 'b, 'c>]], skip_last: bool, our_payment_preimage: PaymentPreimage) {
12411248
for path in expected_paths.iter() {
12421249
assert_eq!(path.last().unwrap().node.get_our_node_id(), expected_paths[0].last().unwrap().node.get_our_node_id());
12431250
}
@@ -1324,6 +1331,9 @@ pub fn claim_payment_along_route<'a, 'b, 'c>(origin_node: &Node<'a, 'b, 'c>, exp
13241331
last_update_fulfill_dance!(origin_node, expected_route.first().unwrap());
13251332
}
13261333
}
1334+
}
1335+
pub fn claim_payment_along_route<'a, 'b, 'c>(origin_node: &Node<'a, 'b, 'c>, expected_paths: &[&[&Node<'a, 'b, 'c>]], skip_last: bool, our_payment_preimage: PaymentPreimage) {
1336+
do_claim_payment_along_route(origin_node, expected_paths, skip_last, our_payment_preimage);
13271337
if !skip_last {
13281338
expect_payment_sent!(origin_node, our_payment_preimage);
13291339
}

lightning/src/ln/functional_tests.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -2659,7 +2659,7 @@ fn test_htlc_on_chain_success() {
26592659
let mut first_claimed = false;
26602660
for event in events {
26612661
match event {
2662-
Event::PaymentSent { payment_preimage, payment_hash } => {
2662+
Event::PaymentSent { payment_preimage, payment_hash, .. } => {
26632663
if payment_preimage == our_payment_preimage && payment_hash == payment_hash_1 {
26642664
assert!(!first_claimed);
26652665
first_claimed = true;
@@ -3350,7 +3350,7 @@ fn test_simple_peer_disconnect() {
33503350
let events = nodes[0].node.get_and_clear_pending_events();
33513351
assert_eq!(events.len(), 2);
33523352
match events[0] {
3353-
Event::PaymentSent { payment_preimage, payment_hash } => {
3353+
Event::PaymentSent { payment_preimage, payment_hash, .. } => {
33543354
assert_eq!(payment_preimage, payment_preimage_3);
33553355
assert_eq!(payment_hash, payment_hash_3);
33563356
},
@@ -3514,7 +3514,7 @@ fn do_test_drop_messages_peer_disconnect(messages_delivered: u8, simulate_broken
35143514
let events_4 = nodes[0].node.get_and_clear_pending_events();
35153515
assert_eq!(events_4.len(), 1);
35163516
match events_4[0] {
3517-
Event::PaymentSent { ref payment_preimage, ref payment_hash } => {
3517+
Event::PaymentSent { ref payment_preimage, ref payment_hash, .. } => {
35183518
assert_eq!(payment_preimage_1, *payment_preimage);
35193519
assert_eq!(payment_hash_1, *payment_hash);
35203520
},
@@ -3555,7 +3555,7 @@ fn do_test_drop_messages_peer_disconnect(messages_delivered: u8, simulate_broken
35553555
let events_4 = nodes[0].node.get_and_clear_pending_events();
35563556
assert_eq!(events_4.len(), 1);
35573557
match events_4[0] {
3558-
Event::PaymentSent { ref payment_preimage, ref payment_hash } => {
3558+
Event::PaymentSent { ref payment_preimage, ref payment_hash, .. } => {
35593559
assert_eq!(payment_preimage_1, *payment_preimage);
35603560
assert_eq!(payment_hash_1, *payment_hash);
35613561
},
@@ -3790,7 +3790,7 @@ fn test_drop_messages_peer_disconnect_dual_htlc() {
37903790
let events_3 = nodes[0].node.get_and_clear_pending_events();
37913791
assert_eq!(events_3.len(), 1);
37923792
match events_3[0] {
3793-
Event::PaymentSent { ref payment_preimage, ref payment_hash } => {
3793+
Event::PaymentSent { ref payment_preimage, ref payment_hash, .. } => {
37943794
assert_eq!(*payment_preimage, payment_preimage_1);
37953795
assert_eq!(*payment_hash, payment_hash_1);
37963796
},
@@ -5059,7 +5059,7 @@ fn test_duplicate_payment_hash_one_failure_one_success() {
50595059

50605060
let events = nodes[0].node.get_and_clear_pending_events();
50615061
match events[0] {
5062-
Event::PaymentSent { ref payment_preimage, ref payment_hash } => {
5062+
Event::PaymentSent { ref payment_preimage, ref payment_hash, .. } => {
50635063
assert_eq!(*payment_preimage, our_payment_preimage);
50645064
assert_eq!(*payment_hash, duplicate_payment_hash);
50655065
}
@@ -5572,7 +5572,7 @@ fn do_htlc_claim_local_commitment_only(use_dust: bool) {
55725572
let events = nodes[0].node.get_and_clear_pending_events();
55735573
assert_eq!(events.len(), 1);
55745574
match events[0] {
5575-
Event::PaymentSent { payment_preimage, payment_hash } => {
5575+
Event::PaymentSent { payment_preimage, payment_hash, .. } => {
55765576
assert_eq!(payment_preimage, our_payment_preimage);
55775577
assert_eq!(payment_hash, our_payment_hash);
55785578
},
@@ -6000,7 +6000,7 @@ fn test_free_and_fail_holding_cell_htlcs() {
60006000
let events = nodes[0].node.get_and_clear_pending_events();
60016001
assert_eq!(events.len(), 1);
60026002
match events[0] {
6003-
Event::PaymentSent { ref payment_preimage, ref payment_hash } => {
6003+
Event::PaymentSent { ref payment_preimage, ref payment_hash, .. } => {
60046004
assert_eq!(*payment_preimage, payment_preimage_1);
60056005
assert_eq!(*payment_hash, payment_hash_1);
60066006
}

lightning/src/ln/payment_tests.rs

+10-3
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ fn do_retry_with_no_persist(confirm_before_reload: bool) {
296296
let mut nodes = create_network(3, &node_cfgs, &node_chanmgrs);
297297

298298
let (_, _, chan_id, funding_tx) = create_announced_chan_between_nodes(&nodes, 0, 1, InitFeatures::known(), InitFeatures::known());
299-
create_announced_chan_between_nodes(&nodes, 1, 2, InitFeatures::known(), InitFeatures::known());
299+
let (_, _, chan_id_2, _) = create_announced_chan_between_nodes(&nodes, 1, 2, InitFeatures::known(), InitFeatures::known());
300300

301301
// Serialize the ChannelManager prior to sending payments
302302
let nodes_0_serialized = nodes[0].node.encode();
@@ -445,15 +445,22 @@ fn do_retry_with_no_persist(confirm_before_reload: bool) {
445445
// Finally, retry the payment (which was reloaded from the ChannelMonitor when nodes[0] was
446446
// reloaded) via a route over the new channel, which work without issue and eventually be
447447
// received and claimed at the recipient just like any other payment.
448-
let (new_route, _, _, _) = get_route_and_payment_hash!(nodes[0], nodes[2], 1_000_000);
448+
let (mut new_route, _, _, _) = get_route_and_payment_hash!(nodes[0], nodes[2], 1_000_000);
449+
450+
// Update the fee on the middle hop to ensure PaymentSent events have the correct (retried) fee
451+
// and not the original fee. We also update node[1]'s relevant config as
452+
// do_claim_payment_along_route expects us to never overpay.
453+
nodes[1].node.channel_state.lock().unwrap().by_id.get_mut(&chan_id_2).unwrap().config.forwarding_fee_base_msat += 100_000;
454+
new_route.paths[0][0].fee_msat += 100_000;
449455

450456
assert!(nodes[0].node.retry_payment(&new_route, payment_id_1).is_err()); // Shouldn't be allowed to retry a fulfilled payment
451457
nodes[0].node.retry_payment(&new_route, payment_id).unwrap();
452458
check_added_monitors!(nodes[0], 1);
453459
let mut events = nodes[0].node.get_and_clear_pending_msg_events();
454460
assert_eq!(events.len(), 1);
455461
pass_along_path(&nodes[0], &[&nodes[1], &nodes[2]], 1_000_000, payment_hash, Some(payment_secret), events.pop().unwrap(), true, None);
456-
claim_payment_along_route(&nodes[0], &[&[&nodes[1], &nodes[2]]], false, payment_preimage);
462+
do_claim_payment_along_route(&nodes[0], &[&[&nodes[1], &nodes[2]]], false, payment_preimage);
463+
expect_payment_sent!(nodes[0], payment_preimage, Some(new_route.paths[0][0].fee_msat));
457464
}
458465

459466
#[test]

lightning/src/ln/shutdown_tests.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ fn updates_shutdown_wait() {
131131
let events = nodes[0].node.get_and_clear_pending_events();
132132
assert_eq!(events.len(), 1);
133133
match events[0] {
134-
Event::PaymentSent { ref payment_preimage, ref payment_hash } => {
134+
Event::PaymentSent { ref payment_preimage, ref payment_hash, .. } => {
135135
assert_eq!(our_payment_preimage, *payment_preimage);
136136
assert_eq!(our_payment_hash, *payment_hash);
137137
},
@@ -309,7 +309,7 @@ fn do_test_shutdown_rebroadcast(recv_count: u8) {
309309
let events = nodes[0].node.get_and_clear_pending_events();
310310
assert_eq!(events.len(), 1);
311311
match events[0] {
312-
Event::PaymentSent { ref payment_preimage, ref payment_hash } => {
312+
Event::PaymentSent { ref payment_preimage, ref payment_hash, .. } => {
313313
assert_eq!(our_payment_preimage, *payment_preimage);
314314
assert_eq!(our_payment_hash, *payment_hash);
315315
},

0 commit comments

Comments
 (0)