@@ -6383,10 +6383,11 @@ where
6383
6383
if let PendingHTLCRouting::Forward { ref onion_packet, .. } = routing {
6384
6384
let phantom_pubkey_res = self.node_signer.get_node_id(Recipient::PhantomNode);
6385
6385
if phantom_pubkey_res.is_ok() && fake_scid::is_valid_phantom(&self.fake_scid_rand_bytes, short_chan_id, &self.chain_hash) {
6386
- let next_hop = match onion_utils::decode_next_payment_hop(
6386
+ let decode_res = onion_utils::decode_next_payment_hop(
6387
6387
Recipient::PhantomNode, &onion_packet.public_key.unwrap(), &onion_packet.hop_data,
6388
6388
onion_packet.hmac, payment_hash, None, &*self.node_signer
6389
- ) {
6389
+ );
6390
+ let next_hop = match decode_res {
6390
6391
Ok(res) => res,
6391
6392
Err(onion_utils::OnionDecodeErr::Malformed { err_msg, reason }) => {
6392
6393
let sha256_of_onion = Sha256::hash(&onion_packet.hop_data).to_byte_array();
@@ -6403,10 +6404,11 @@ where
6403
6404
};
6404
6405
let phantom_shared_secret = next_hop.shared_secret().secret_bytes();
6405
6406
let current_height: u32 = self.best_block.read().unwrap().height;
6406
- match create_recv_pending_htlc_info(next_hop,
6407
+ let create_res = create_recv_pending_htlc_info(next_hop,
6407
6408
incoming_shared_secret, payment_hash, outgoing_amt_msat,
6408
6409
outgoing_cltv_value, Some(phantom_shared_secret), false, None,
6409
- current_height)
6410
+ current_height);
6411
+ match create_res
6410
6412
{
6411
6413
Ok(info) => phantom_receives.push((
6412
6414
prev_short_channel_id, prev_counterparty_node_id, prev_funding_outpoint,
@@ -6941,20 +6943,20 @@ where
6941
6943
// associated with the same payment_hash pending or not.
6942
6944
let payment_preimage = if has_recipient_created_payment_secret {
6943
6945
if let Some(ref payment_data) = payment_data {
6944
- let (payment_preimage, min_final_cltv_expiry_delta) =
6945
- match inbound_payment::verify(
6946
- payment_hash ,
6947
- &payment_data ,
6948
- self.highest_seen_timestamp.load(Ordering::Acquire) as u64 ,
6949
- &self.inbound_payment_key ,
6950
- &self.logger,
6951
- ) {
6952
- Ok(result) => result,
6953
- Err(()) => {
6954
- log_trace!(self.logger, "Failing new HTLC with payment_hash {} as payment verification failed", &payment_hash);
6955
- fail_htlc!(claimable_htlc, payment_hash);
6956
- },
6957
- };
6946
+ let verify_res = inbound_payment::verify(
6947
+ payment_hash,
6948
+ &payment_data ,
6949
+ self.highest_seen_timestamp.load(Ordering::Acquire) as u64 ,
6950
+ & self.inbound_payment_key ,
6951
+ &self.logger ,
6952
+ );
6953
+ let (payment_preimage, min_final_cltv_expiry_delta) = match verify_res {
6954
+ Ok(result) => result,
6955
+ Err(()) => {
6956
+ log_trace!(self.logger, "Failing new HTLC with payment_hash {} as payment verification failed", &payment_hash);
6957
+ fail_htlc!(claimable_htlc, payment_hash);
6958
+ },
6959
+ };
6958
6960
if let Some(min_final_cltv_expiry_delta) = min_final_cltv_expiry_delta {
6959
6961
let expected_min_expiry_height = (self.current_best_block().height
6960
6962
+ min_final_cltv_expiry_delta as u32)
@@ -6975,11 +6977,12 @@ where
6975
6977
match claimable_htlc.onion_payload {
6976
6978
OnionPayload::Invoice { .. } => {
6977
6979
let payment_data = payment_data.unwrap();
6978
- let purpose = match events::PaymentPurpose::from_parts(
6980
+ let from_parts_res = events::PaymentPurpose::from_parts(
6979
6981
payment_preimage,
6980
6982
payment_data.payment_secret,
6981
6983
payment_context,
6982
- ) {
6984
+ );
6985
+ let purpose = match from_parts_res {
6983
6986
Ok(purpose) => purpose,
6984
6987
Err(()) => {
6985
6988
fail_htlc!(claimable_htlc, payment_hash);
@@ -7003,15 +7006,16 @@ where
7003
7006
},
7004
7007
};
7005
7008
7006
- let verified_invreq = match invoice_request_opt.and_then(|invreq| {
7009
+ let verify_opt = invoice_request_opt.and_then(|invreq| {
7007
7010
invreq
7008
7011
.verify_using_recipient_data(
7009
7012
offer_nonce,
7010
7013
&self.inbound_payment_key,
7011
7014
&self.secp_ctx,
7012
7015
)
7013
7016
.ok()
7014
- }) {
7017
+ });
7018
+ let verified_invreq = match verify_opt {
7015
7019
Some(verified_invreq) => {
7016
7020
if let Some(invreq_amt_msat) =
7017
7021
verified_invreq.amount_msats()
@@ -7031,11 +7035,12 @@ where
7031
7035
offer_id: verified_invreq.offer_id,
7032
7036
invoice_request: verified_invreq.fields(),
7033
7037
});
7034
- match events::PaymentPurpose::from_parts(
7038
+ let from_parts_res = events::PaymentPurpose::from_parts(
7035
7039
Some(keysend_preimage),
7036
7040
payment_data.payment_secret,
7037
7041
Some(payment_purpose_context),
7038
- ) {
7042
+ );
7043
+ match from_parts_res {
7039
7044
Ok(purpose) => purpose,
7040
7045
Err(()) => {
7041
7046
fail_htlc!(claimable_htlc, payment_hash);
0 commit comments