Skip to content

Commit 8b2d232

Browse files
fail intercepted payment
1 parent 312b7cb commit 8b2d232

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3089,9 +3089,20 @@ impl<Signer: Sign, M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelMana
30893089
pending_intercepts.remove(&intercept_id)
30903090
};
30913091

3092-
if let Some(_payment) = pending_intercept {
3093-
// TODO: what's best way to fail this? in `process_pending_htlc_forwards` it uses that `fail_forward` macro
3094-
// awkward way could be to just use the forward_intercepted_payment code and pick a random scid
3092+
if let Some(payment) = pending_intercept {
3093+
if let HTLCForwardInfo::AddHTLC { forward_info, prev_short_channel_id, prev_htlc_id, prev_funding_outpoint, .. } = payment {
3094+
3095+
let htlc_source = HTLCSource::PreviousHopData(HTLCPreviousHopData {
3096+
short_channel_id: prev_short_channel_id,
3097+
outpoint: prev_funding_outpoint,
3098+
htlc_id: prev_htlc_id,
3099+
incoming_packet_shared_secret: forward_info.incoming_shared_secret,
3100+
phantom_shared_secret: None,
3101+
});
3102+
3103+
let failure_reason = HTLCFailReason::Reason { failure_code: 0x4000 | 10, data: Vec::new() };
3104+
self.fail_htlc_backwards_internal(self.channel_state.lock().unwrap(), htlc_source, &forward_info.payment_hash, failure_reason);
3105+
}
30953106
}
30963107
}
30973108

0 commit comments

Comments
 (0)