Skip to content

Commit 36e6023

Browse files
authored
Merge pull request #1902 from tnull/2022-12-payment-received-renaming-follow-up
Also rename variables referring to `PaymentClaimable`
2 parents 5588eeb + e09ca27 commit 36e6023

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

lightning/src/ln/channelmanager.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -3476,7 +3476,7 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
34763476

34773477
macro_rules! check_total_value {
34783478
($payment_data: expr, $payment_preimage: expr) => {{
3479-
let mut payment_received_generated = false;
3479+
let mut payment_claimable_generated = false;
34803480
let purpose = || {
34813481
events::PaymentPurpose::InvoicePayment {
34823482
payment_preimage: $payment_preimage,
@@ -3523,14 +3523,14 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
35233523
via_channel_id: Some(prev_channel_id),
35243524
via_user_channel_id: Some(prev_user_channel_id),
35253525
});
3526-
payment_received_generated = true;
3526+
payment_claimable_generated = true;
35273527
} else {
35283528
// Nothing to do - we haven't reached the total
35293529
// payment value yet, wait until we receive more
35303530
// MPP parts.
35313531
htlcs.push(claimable_htlc);
35323532
}
3533-
payment_received_generated
3533+
payment_claimable_generated
35343534
}}
35353535
}
35363536

@@ -3593,8 +3593,8 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
35933593
log_bytes!(payment_hash.0), payment_data.total_msat, inbound_payment.get().min_value_msat.unwrap());
35943594
fail_htlc!(claimable_htlc, payment_hash);
35953595
} else {
3596-
let payment_received_generated = check_total_value!(payment_data, inbound_payment.get().payment_preimage);
3597-
if payment_received_generated {
3596+
let payment_claimable_generated = check_total_value!(payment_data, inbound_payment.get().payment_preimage);
3597+
if payment_claimable_generated {
35983598
inbound_payment.remove_entry();
35993599
}
36003600
}

lightning/src/ln/functional_test_utils.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1756,7 +1756,7 @@ pub fn send_along_route_with_secret<'a, 'b, 'c>(origin_node: &Node<'a, 'b, 'c>,
17561756
payment_id
17571757
}
17581758

1759-
pub fn do_pass_along_path<'a, 'b, 'c>(origin_node: &Node<'a, 'b, 'c>, expected_path: &[&Node<'a, 'b, 'c>], recv_value: u64, our_payment_hash: PaymentHash, our_payment_secret: Option<PaymentSecret>, ev: MessageSendEvent, payment_received_expected: bool, clear_recipient_events: bool, expected_preimage: Option<PaymentPreimage>) {
1759+
pub fn do_pass_along_path<'a, 'b, 'c>(origin_node: &Node<'a, 'b, 'c>, expected_path: &[&Node<'a, 'b, 'c>], recv_value: u64, our_payment_hash: PaymentHash, our_payment_secret: Option<PaymentSecret>, ev: MessageSendEvent, payment_claimable_expected: bool, clear_recipient_events: bool, expected_preimage: Option<PaymentPreimage>) {
17601760
let mut payment_event = SendEvent::from_event(ev);
17611761
let mut prev_node = origin_node;
17621762

@@ -1771,7 +1771,7 @@ pub fn do_pass_along_path<'a, 'b, 'c>(origin_node: &Node<'a, 'b, 'c>, expected_p
17711771

17721772
if idx == expected_path.len() - 1 && clear_recipient_events {
17731773
let events_2 = node.node.get_and_clear_pending_events();
1774-
if payment_received_expected {
1774+
if payment_claimable_expected {
17751775
assert_eq!(events_2.len(), 1);
17761776
match events_2[0] {
17771777
Event::PaymentClaimable { ref payment_hash, ref purpose, amount_msat, receiver_node_id, ref via_channel_id, ref via_user_channel_id } => {
@@ -1808,8 +1808,8 @@ pub fn do_pass_along_path<'a, 'b, 'c>(origin_node: &Node<'a, 'b, 'c>, expected_p
18081808
}
18091809
}
18101810

1811-
pub fn pass_along_path<'a, 'b, 'c>(origin_node: &Node<'a, 'b, 'c>, expected_path: &[&Node<'a, 'b, 'c>], recv_value: u64, our_payment_hash: PaymentHash, our_payment_secret: Option<PaymentSecret>, ev: MessageSendEvent, payment_received_expected: bool, expected_preimage: Option<PaymentPreimage>) {
1812-
do_pass_along_path(origin_node, expected_path, recv_value, our_payment_hash, our_payment_secret, ev, payment_received_expected, true, expected_preimage);
1811+
pub fn pass_along_path<'a, 'b, 'c>(origin_node: &Node<'a, 'b, 'c>, expected_path: &[&Node<'a, 'b, 'c>], recv_value: u64, our_payment_hash: PaymentHash, our_payment_secret: Option<PaymentSecret>, ev: MessageSendEvent, payment_claimable_expected: bool, expected_preimage: Option<PaymentPreimage>) {
1812+
do_pass_along_path(origin_node, expected_path, recv_value, our_payment_hash, our_payment_secret, ev, payment_claimable_expected, true, expected_preimage);
18131813
}
18141814

18151815
pub fn pass_along_route<'a, 'b, 'c>(origin_node: &Node<'a, 'b, 'c>, expected_route: &[&[&Node<'a, 'b, 'c>]], recv_value: u64, our_payment_hash: PaymentHash, our_payment_secret: PaymentSecret) {

0 commit comments

Comments
 (0)