Skip to content

Commit 9a76b6f

Browse files
committed
f serialization
1 parent 2611741 commit 9a76b6f

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

lightning/src/ln/msgs.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1746,8 +1746,7 @@ pub struct FinalOnionHopData {
17461746

17471747
mod fuzzy_internal_msgs {
17481748
use bitcoin::secp256k1::PublicKey;
1749-
use crate::blinded_path::BlindedPath;
1750-
use crate::blinded_path::payment::{PaymentConstraints, PaymentContext, PaymentRelay};
1749+
use crate::blinded_path::payment::{BlindedPaymentPath, PaymentConstraints, PaymentContext, PaymentRelay};
17511750
use crate::ln::types::{PaymentPreimage, PaymentSecret};
17521751
use crate::ln::features::{BlindedHopFeatures, Bolt12InvoiceFeatures};
17531752
use super::{FinalOnionHopData, TrampolineOnionPacket};
@@ -1841,12 +1840,14 @@ mod fuzzy_internal_msgs {
18411840
outgoing_node_id: PublicKey,
18421841
},
18431842
#[allow(unused)]
1843+
/// This is the last Trampoline hop, whereupon the Trampoline forward mechanism is exited,
1844+
/// and payment data is relayed using non-Trampoline blinded hops
18441845
BlindedForward {
18451846
/// The value, in msat, of the payment after this hop's fee is deducted.
18461847
amt_to_forward: u64,
18471848
outgoing_cltv_value: u32,
18481849
/// List of blinded path options the last trampoline hop may choose to route through.
1849-
payment_paths: Vec<BlindedPath>,
1850+
payment_paths: Vec<BlindedPaymentPath>,
18501851
/// If applicable, features of the BOLT12 invoice being paid.
18511852
invoice_features: Option<Bolt12InvoiceFeatures>
18521853
},
@@ -2776,12 +2777,16 @@ impl Writeable for OutboundTrampolinePayload {
27762777
});
27772778
},
27782779
Self::BlindedForward { amt_to_forward, outgoing_cltv_value, payment_paths, invoice_features } => {
2780+
let blinded_path_value: Vec<u8> = payment_paths.iter().flat_map(|p| {
2781+
p.inner_blinded_path().encode().into_iter().chain(p.payinfo.encode()).collect::<Vec<u8>>()
2782+
}).collect();
2783+
let blinded_path_tlv = (22, blinded_path_value);
2784+
27792785
_encode_varint_length_prefixed_tlv!(w, {
27802786
(2, HighZeroBytesDroppedBigSize(*amt_to_forward), required),
27812787
(4, HighZeroBytesDroppedBigSize(*outgoing_cltv_value), required),
2782-
(66097, invoice_features, option),
2783-
(66102, *payment_paths, required_vec)
2784-
});
2788+
(21, invoice_features.as_ref().map(|m| WithoutLength(m)), option)
2789+
}, [&blinded_path_tlv]);
27852790
},
27862791
}
27872792
Ok(())

0 commit comments

Comments
 (0)