Skip to content

Commit 3048969

Browse files
Support (de)serializing Path::blinded_tails in HTLCSource
1 parent 4bb7257 commit 3048969

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ use crate::ln::features::{ChannelFeatures, ChannelTypeFeatures, InitFeatures, No
4545
#[cfg(any(feature = "_test_utils", test))]
4646
use crate::ln::features::InvoiceFeatures;
4747
use crate::routing::gossip::NetworkGraph;
48-
use crate::routing::router::{DefaultRouter, InFlightHtlcs, Path, PaymentParameters, Route, RouteHop, RouteParameters, RoutePath, Router};
48+
use crate::routing::router::{BlindedTail, DefaultRouter, InFlightHtlcs, Path, PaymentParameters, Route, RouteHop, RouteParameters, RoutePath, Router};
4949
use crate::routing::scoring::ProbabilisticScorer;
5050
use crate::ln::msgs;
5151
use crate::ln::onion_utils;
@@ -6877,22 +6877,24 @@ impl Readable for HTLCSource {
68776877
let mut path: Option<Vec<RouteHop>> = Some(Vec::new());
68786878
let mut payment_id = None;
68796879
let mut payment_params: Option<PaymentParameters> = None;
6880+
let mut blinded_tail: Option<BlindedTail> = None;
68806881
read_tlv_fields!(reader, {
68816882
(0, session_priv, required),
68826883
(1, payment_id, option),
68836884
(2, first_hop_htlc_msat, required),
68846885
(4, path, vec_type),
68856886
(5, payment_params, (option: ReadableArgs, 0)),
6887+
(6, blinded_tail, option),
68866888
});
68876889
if payment_id.is_none() {
68886890
// For backwards compat, if there was no payment_id written, use the session_priv bytes
68896891
// instead.
68906892
payment_id = Some(PaymentId(*session_priv.0.unwrap().as_ref()));
68916893
}
6892-
if path.is_none() || path.as_ref().unwrap().is_empty() {
6894+
let path = path.unwrap_or(Vec::new());
6895+
if path.is_empty() && blinded_tail.is_none() {
68936896
return Err(DecodeError::InvalidValue);
68946897
}
6895-
let path = path.unwrap();
68966898
if let Some(params) = payment_params.as_mut() {
68976899
if params.final_cltv_expiry_delta == 0 {
68986900
params.final_cltv_expiry_delta = path.last().unwrap().cltv_expiry_delta;
@@ -6924,6 +6926,7 @@ impl Writeable for HTLCSource {
69246926
// 3 was previously used to write a PaymentSecret for the payment.
69256927
(4, path.hops, vec_type),
69266928
(5, None::<PaymentParameters>, option), // payment_params in LDK versions prior to 0.0.115
6929+
(6, path.blinded_tail, option),
69276930
});
69286931
}
69296932
HTLCSource::PreviousHopData(ref field) => {

0 commit comments

Comments
 (0)