@@ -3162,12 +3162,10 @@ where
3162
3162
3163
3163
fn decode_update_add_htlc_onion(
3164
3164
&self, msg: &msgs::UpdateAddHTLC, counterparty_node_id: &PublicKey, channel: Option<&mut Channel<SP>>,
3165
- ) -> Result<
3166
- (onion_utils::Hop, [u8; 32], Option<Result<PublicKey, secp256k1::Error>>), HTLCFailureMsg
3167
- > {
3165
+ ) -> Result<(onion_utils::Hop, [u8; 32], Option<Result<PublicKey, secp256k1::Error>>), (HTLCFailureMsg, Option<u64>)> {
3168
3166
let (next_hop, shared_secret, next_packet_details_opt) = decode_incoming_update_add_htlc_onion(
3169
3167
msg, &self.node_signer, &self.logger, &self.secp_ctx
3170
- )?;
3168
+ ).map_err(|fail_msg| (fail_msg, None)) ?;
3171
3169
3172
3170
let next_packet_details = match next_packet_details_opt {
3173
3171
Some(next_packet_details) => next_packet_details,
@@ -3185,7 +3183,14 @@ where
3185
3183
};
3186
3184
3187
3185
let fail_msg_from_err = |err_msg: &'static str, err_code: u16, chan_update: Option<msgs::ChannelUpdate>| {
3188
- self.process_failed_accept_err(msg, counterparty_node_id, err_msg, err_code, chan_update, is_intro_node_forward, &shared_secret)
3186
+ let fail_msg = self.process_failed_accept_err(
3187
+ msg, counterparty_node_id, err_msg, err_code, chan_update, is_intro_node_forward, &shared_secret
3188
+ );
3189
+ let outgoing_scid = match &fail_msg {
3190
+ HTLCFailureMsg::Relay(_) => Some(next_packet_details.outgoing_scid),
3191
+ HTLCFailureMsg::Malformed(_) => None,
3192
+ };
3193
+ (fail_msg, outgoing_scid)
3189
3194
};
3190
3195
3191
3196
let res = if let Some(channel) = channel {
@@ -6679,7 +6684,7 @@ where
6679
6684
msg, counterparty_node_id, shared_secret, next_hop,
6680
6685
chan.context.config().accept_underpaying_htlcs, next_packet_pk_opt,
6681
6686
),
6682
- Err(e) => PendingHTLCStatus::Fail(e )
6687
+ Err((fail_msg, _)) => PendingHTLCStatus::Fail(fail_msg )
6683
6688
};
6684
6689
let create_pending_htlc_status = |chan: &Channel<SP>, pending_forward_info: PendingHTLCStatus, error_code: u16| {
6685
6690
if msg.blinding_point.is_some() {
0 commit comments