match events_3[0] {
Event::PaymentReceived { ref payment_hash, ref payment_secret, amt, user_payment_id: _ } => {
assert_eq!(payment_hash_1, *payment_hash);
- assert_eq!(Some(payment_secret_1), *payment_secret);
+ assert_eq!(payment_secret_1, *payment_secret);
assert_eq!(amt, 1000000);
},
_ => panic!("Unexpected event"),
match events_5[0] {
Event::PaymentReceived { ref payment_hash, ref payment_secret, amt, user_payment_id: _ } => {
assert_eq!(payment_hash_2, *payment_hash);
- assert_eq!(Some(payment_secret_2), *payment_secret);
+ assert_eq!(payment_secret_2, *payment_secret);
assert_eq!(amt, 1000000);
},
_ => panic!("Unexpected event"),
match events[0] {
Event::PaymentReceived { payment_hash, payment_secret, amt, user_payment_id: _ } => {
assert_eq!(payment_hash, our_payment_hash);
- assert_eq!(Some(our_payment_secret), payment_secret);
+ assert_eq!(our_payment_secret, payment_secret);
assert_eq!(amt, 1000000);
},
_ => panic!("Unexpected event"),
} else if total_value == payment_data.total_msat {
new_events.push(events::Event::PaymentReceived {
payment_hash,
- payment_secret: Some(payment_data.payment_secret),
+ payment_secret: payment_data.payment_secret,
amt: total_value,
user_payment_id: inbound_payment.get().user_payment_id,
});
match events[0] {
Event::PaymentReceived { ref payment_hash, ref payment_secret, amt, user_payment_id: _ } => {
assert_eq!($expected_payment_hash, *payment_hash);
- assert_eq!(Some($expected_payment_secret), *payment_secret);
+ assert_eq!($expected_payment_secret, *payment_secret);
assert_eq!($expected_recv_value, amt);
},
_ => panic!("Unexpected event"),
match events_2[0] {
Event::PaymentReceived { ref payment_hash, ref payment_secret, amt, user_payment_id: _ } => {
assert_eq!(our_payment_hash, *payment_hash);
- assert_eq!(Some(our_payment_secret), *payment_secret);
+ assert_eq!(our_payment_secret, *payment_secret);
assert_eq!(amt, recv_value);
},
_ => panic!("Unexpected event"),
match events[0] {
Event::PaymentReceived { ref payment_hash, ref payment_secret, amt, user_payment_id: _ } => {
assert_eq!(our_payment_hash_21, *payment_hash);
- assert_eq!(Some(our_payment_secret_21), *payment_secret);
+ assert_eq!(our_payment_secret_21, *payment_secret);
assert_eq!(recv_value_21, amt);
},
_ => panic!("Unexpected event"),
match events[1] {
Event::PaymentReceived { ref payment_hash, ref payment_secret, amt, user_payment_id: _ } => {
assert_eq!(our_payment_hash_22, *payment_hash);
- assert_eq!(Some(our_payment_secret_22), *payment_secret);
+ assert_eq!(our_payment_secret_22, *payment_secret);
assert_eq!(recv_value_22, amt);
},
_ => panic!("Unexpected event"),
match events_2[0] {
Event::PaymentReceived { ref payment_hash, ref payment_secret, amt, user_payment_id: _ } => {
assert_eq!(payment_hash_1, *payment_hash);
- assert_eq!(Some(payment_secret_1), *payment_secret);
+ assert_eq!(payment_secret_1, *payment_secret);
assert_eq!(amt, 1000000);
},
_ => panic!("Unexpected event"),
match events_5[0] {
Event::PaymentReceived { ref payment_hash, ref payment_secret, amt: _, user_payment_id: _ } => {
assert_eq!(payment_hash_2, *payment_hash);
- assert_eq!(Some(payment_secret_2), *payment_secret);
+ assert_eq!(payment_secret_2, *payment_secret);
},
_ => panic!("Unexpected event"),
}
payment_hash: PaymentHash,
/// The "payment secret". This authenticates the sender to the recipient, preventing a
/// number of deanonymization attacks during the routing process.
- /// As nodes upgrade, the invoices you provide should likely migrate to setting the
- /// payment_secret feature to required, at which point you should fail_backwards any HTLCs
- /// which have a None here.
- /// Until then, however, values of None should be ignored, and only incorrect Some values
- /// should result in an HTLC fail_backwards.
- /// Note that, in any case, this value must be passed as-is to any fail or claim calls as
- /// the HTLC index includes this value.
- payment_secret: Option<PaymentSecret>,
+ /// It is provided here for your reference, however its accuracy is enforced directly by
+ /// [`ChannelManager`] using the values you previously provided to
+ /// [`ChannelManager::create_inbound_payment`] or
+ /// [`ChannelManager::create_inbound_payment_for_hash`].
+ ///
+ /// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
+ /// [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
+ /// [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
+ payment_secret: PaymentSecret,
/// The value, in thousandths of a satoshi, that this payment is for. Note that you must
/// compare this to the expected value before accepting the payment (as otherwise you are
/// providing proof-of-payment for less than the value you expected!).