Skip to content

Commit 01ae795

Browse files
committed
Make the PaymentSecret in PaymentReceived events non-Optional
1 parent 3871037 commit 01ae795

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

lightning/src/ln/chanmon_update_fail_tests.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ fn do_test_simple_monitor_temporary_update_fail(disconnect: bool, persister_fail
207207
match events_3[0] {
208208
Event::PaymentReceived { ref payment_hash, ref payment_secret, amt, user_payment_id: _ } => {
209209
assert_eq!(payment_hash_1, *payment_hash);
210-
assert_eq!(Some(payment_secret_1), *payment_secret);
210+
assert_eq!(payment_secret_1, *payment_secret);
211211
assert_eq!(amt, 1000000);
212212
},
213213
_ => panic!("Unexpected event"),
@@ -575,7 +575,7 @@ fn do_test_monitor_temporary_update_fail(disconnect_count: usize) {
575575
match events_5[0] {
576576
Event::PaymentReceived { ref payment_hash, ref payment_secret, amt, user_payment_id: _ } => {
577577
assert_eq!(payment_hash_2, *payment_hash);
578-
assert_eq!(Some(payment_secret_2), *payment_secret);
578+
assert_eq!(payment_secret_2, *payment_secret);
579579
assert_eq!(amt, 1000000);
580580
},
581581
_ => panic!("Unexpected event"),
@@ -689,7 +689,7 @@ fn test_monitor_update_fail_cs() {
689689
match events[0] {
690690
Event::PaymentReceived { payment_hash, payment_secret, amt, user_payment_id: _ } => {
691691
assert_eq!(payment_hash, our_payment_hash);
692-
assert_eq!(Some(our_payment_secret), payment_secret);
692+
assert_eq!(our_payment_secret, payment_secret);
693693
assert_eq!(amt, 1000000);
694694
},
695695
_ => panic!("Unexpected event"),

lightning/src/ln/channelmanager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1995,7 +1995,7 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
19951995
} else if total_value == payment_data.total_msat {
19961996
new_events.push(events::Event::PaymentReceived {
19971997
payment_hash,
1998-
payment_secret: Some(payment_data.payment_secret),
1998+
payment_secret: payment_data.payment_secret,
19991999
amt: total_value,
20002000
user_payment_id,
20012001
});

lightning/src/ln/functional_test_utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ macro_rules! expect_payment_received {
943943
match events[0] {
944944
Event::PaymentReceived { ref payment_hash, ref payment_secret, amt, user_payment_id: _ } => {
945945
assert_eq!($expected_payment_hash, *payment_hash);
946-
assert_eq!(Some($expected_payment_secret), *payment_secret);
946+
assert_eq!($expected_payment_secret, *payment_secret);
947947
assert_eq!($expected_recv_value, amt);
948948
},
949949
_ => panic!("Unexpected event"),
@@ -1011,7 +1011,7 @@ pub fn pass_along_path<'a, 'b, 'c>(origin_node: &Node<'a, 'b, 'c>, expected_path
10111011
match events_2[0] {
10121012
Event::PaymentReceived { ref payment_hash, ref payment_secret, amt, user_payment_id: _ } => {
10131013
assert_eq!(our_payment_hash, *payment_hash);
1014-
assert_eq!(Some(our_payment_secret), *payment_secret);
1014+
assert_eq!(our_payment_secret, *payment_secret);
10151015
assert_eq!(amt, recv_value);
10161016
},
10171017
_ => panic!("Unexpected event"),

lightning/src/ln/functional_tests.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2071,15 +2071,15 @@ fn test_channel_reserve_holding_cell_htlcs() {
20712071
match events[0] {
20722072
Event::PaymentReceived { ref payment_hash, ref payment_secret, amt, user_payment_id: _ } => {
20732073
assert_eq!(our_payment_hash_21, *payment_hash);
2074-
assert_eq!(Some(our_payment_secret_21), *payment_secret);
2074+
assert_eq!(our_payment_secret_21, *payment_secret);
20752075
assert_eq!(recv_value_21, amt);
20762076
},
20772077
_ => panic!("Unexpected event"),
20782078
}
20792079
match events[1] {
20802080
Event::PaymentReceived { ref payment_hash, ref payment_secret, amt, user_payment_id: _ } => {
20812081
assert_eq!(our_payment_hash_22, *payment_hash);
2082-
assert_eq!(Some(our_payment_secret_22), *payment_secret);
2082+
assert_eq!(our_payment_secret_22, *payment_secret);
20832083
assert_eq!(recv_value_22, amt);
20842084
},
20852085
_ => panic!("Unexpected event"),
@@ -3647,7 +3647,7 @@ fn do_test_drop_messages_peer_disconnect(messages_delivered: u8) {
36473647
match events_2[0] {
36483648
Event::PaymentReceived { ref payment_hash, ref payment_secret, amt, user_payment_id: _ } => {
36493649
assert_eq!(payment_hash_1, *payment_hash);
3650-
assert_eq!(Some(payment_secret_1), *payment_secret);
3650+
assert_eq!(payment_secret_1, *payment_secret);
36513651
assert_eq!(amt, 1000000);
36523652
},
36533653
_ => panic!("Unexpected event"),
@@ -3984,7 +3984,7 @@ fn test_drop_messages_peer_disconnect_dual_htlc() {
39843984
match events_5[0] {
39853985
Event::PaymentReceived { ref payment_hash, ref payment_secret, amt: _, user_payment_id: _ } => {
39863986
assert_eq!(payment_hash_2, *payment_hash);
3987-
assert_eq!(Some(payment_secret_2), *payment_secret);
3987+
assert_eq!(payment_secret_2, *payment_secret);
39883988
},
39893989
_ => panic!("Unexpected event"),
39903990
}

lightning/src/util/events.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ pub enum Event {
7070
/// should result in an HTLC fail_backwards.
7171
/// Note that, in any case, this value must be passed as-is to any fail or claim calls as
7272
/// the HTLC index includes this value.
73-
payment_secret: Option<PaymentSecret>,
73+
payment_secret: PaymentSecret,
7474
/// The value, in thousandths of a satoshi, that this payment is for. Note that you must
7575
/// compare this to the expected value before accepting the payment (as otherwise you are
7676
/// providing proof-of-payment for less than the value you expected!).

0 commit comments

Comments
 (0)