use crate::routing::gossip::NetworkUpdate;
use crate::routing::router::{BlindedTail, Path, RouteHop};
use crate::sign::NodeSigner;
-use crate::util::chacha20::{ChaCha20, ChaChaReader};
+use crate::crypto::chacha20::ChaCha20;
+use crate::crypto::streams::ChaChaReader;
use crate::util::errors::{self, APIError};
use crate::util::ser::{Readable, ReadableArgs, Writeable, Writer, LengthCalculatingWriter};
use crate::util::logger::Logger;
for (i, blinded_hop) in hops.iter().enumerate() {
if i == hops.len() - 1 {
cur_value_msat += final_value_msat;
- cur_cltv += excess_final_cltv_expiry_delta;
res.push(msgs::OutboundOnionPayload::BlindedReceive {
sender_intended_htlc_amt_msat: *final_value_msat,
total_msat,
- cltv_expiry_height: cltv,
+ cltv_expiry_height: cur_cltv + excess_final_cltv_expiry_delta,
encrypted_tlvs: blinded_hop.encrypted_payload.clone(),
intro_node_blinding_point: blinding_point.take(),
});
pub(crate) network_update: Option<NetworkUpdate>,
pub(crate) short_channel_id: Option<u64>,
pub(crate) payment_failed_permanently: bool,
+ pub(crate) failed_within_blinded_path: bool,
#[cfg(test)]
pub(crate) onion_error_code: Option<u16>,
#[cfg(test)]
network_update: Option<NetworkUpdate>,
short_channel_id: Option<u64>,
payment_failed_permanently: bool,
+ failed_within_blinded_path: bool,
}
let mut res: Option<FailureLearnings> = None;
let mut htlc_msat = *first_hop_htlc_msat;
error_code_ret = Some(BADONION | PERM | 24); // invalid_onion_blinding
error_packet_ret = Some(vec![0; 32]);
res = Some(FailureLearnings {
- network_update: None, short_channel_id: None, payment_failed_permanently: false
+ network_update: None, short_channel_id: None, payment_failed_permanently: false,
+ failed_within_blinded_path: true,
});
return
},
}
res = Some(FailureLearnings {
- network_update: None, short_channel_id: None, payment_failed_permanently: false
+ network_update: None, short_channel_id: None, payment_failed_permanently: false,
+ failed_within_blinded_path: true,
});
return
}
});
let short_channel_id = Some(route_hop.short_channel_id);
res = Some(FailureLearnings {
- network_update, short_channel_id, payment_failed_permanently: is_from_final_node
+ network_update, short_channel_id, payment_failed_permanently: is_from_final_node,
+ failed_within_blinded_path: false
});
return
}
res = Some(FailureLearnings {
network_update, short_channel_id,
- payment_failed_permanently: error_code & PERM == PERM && is_from_final_node
+ payment_failed_permanently: error_code & PERM == PERM && is_from_final_node,
+ failed_within_blinded_path: false
});
let (description, title) = errors::get_onion_error_description(error_code);
}
}).expect("Route that we sent via spontaneously grew invalid keys in the middle of it?");
if let Some(FailureLearnings {
- network_update, short_channel_id, payment_failed_permanently
+ network_update, short_channel_id, payment_failed_permanently, failed_within_blinded_path
}) = res {
DecodedOnionFailure {
- network_update, short_channel_id, payment_failed_permanently,
+ network_update, short_channel_id, payment_failed_permanently, failed_within_blinded_path,
#[cfg(test)]
onion_error_code: error_code_ret,
#[cfg(test)]
// payment not retryable only when garbage is from the final node
DecodedOnionFailure {
network_update: None, short_channel_id: None, payment_failed_permanently: is_from_final_node,
+ failed_within_blinded_path: false,
#[cfg(test)]
onion_error_code: None,
#[cfg(test)]
network_update: None,
payment_failed_permanently: false,
short_channel_id: Some(path.hops[0].short_channel_id),
+ failed_within_blinded_path: false,
#[cfg(test)]
onion_error_code: Some(*failure_code),
#[cfg(test)]