You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This change implements non-strict forwarding, allowing the node to
forward an HTLC along an outgoing channel other than the one specified
by short_channel_id in the onion message, so long as the receiver has
the same node public key intended by short_channel_id
([BOLT](https://github.com/lightning/bolts/blob/57ce4b1e05c996fa649f00dc13521f6d496a288f/04-onion-routing.md#non-strict-forwarding)).
This can result in improved payment reliability e.g. when outbound
liquidity is replenished by opening a new channel.
The implemented forwarding strategy now chooses the channel with the
least amount of outbound liquidity that can forward an HTLC to maximize
the probability of being able to successfully forward a subsequent HTLC.
Fixes#1278.
let logger = WithChannelContext::from(&self.logger, &chan.context, Some(payment_hash));
4985
-
log_trace!(logger, "Adding HTLC from short id {} with payment_hash {} to channel with short id {} after delay", prev_short_channel_id, &payment_hash, short_chan_id);
4986
4985
let htlc_source = HTLCSource::PreviousHopData(HTLCPreviousHopData {
log_trace!(logger, "Adding HTLC from short id {} with payment_hash {} intended for channel with short id {} to channel with short id {} after delay", prev_short_channel_id, &payment_hash, short_chan_id, chan.context.get_short_channel_id().map(|scid| scid.to_string()).unwrap_or("none".to_string()));
5023
+
},
5024
+
Err(ChannelError::Ignore(ref msg)) => {
5025
+
log_trace!(logger, "Not using channel with short id {} to forward HTLC with payment_hash {}: {}", chan.context.get_short_channel_id().map(|scid| scid.to_string()).unwrap_or("none".to_string()), &payment_hash, msg);
5026
+
},
5027
+
Err(_) => {
5028
+
panic!("Stated return value requirements in send_htlc() were not met");
5029
+
},
5030
+
}
5031
+
add_result.is_ok()
5032
+
});
5033
+
5034
+
if !successfully_added {
5035
+
log_trace!(self.logger, "Failed to forward HTLC with payment_hash {} to peer {}", &payment_hash, &counterparty_node_id);
5036
+
if let Some(ChannelPhase::Funded(ref mut chan)) = peer_state.channel_by_id.get_mut(&forward_chan_id) {
5037
+
let (failure_code, data) = self.get_htlc_temp_fail_err_and_data(0x1000|7, short_chan_id, chan);
0 commit comments