Skip to content

Commit e3c86f7

Browse files
committed
TODO: adjust blinded forward serialization
1 parent 4b631d6 commit e3c86f7

File tree

1 file changed

+9
-22
lines changed

1 file changed

+9
-22
lines changed

lightning/src/ln/msgs.rs

+9-22
Original file line numberDiff line numberDiff line change
@@ -1680,7 +1680,7 @@ mod fuzzy_internal_msgs {
16801680
use crate::blinded_path::BlindedPath;
16811681
use crate::blinded_path::payment::{PaymentConstraints, PaymentContext, PaymentRelay};
16821682
use crate::ln::types::{PaymentPreimage, PaymentSecret};
1683-
use crate::ln::features::BlindedHopFeatures;
1683+
use crate::ln::features::{BlindedHopFeatures, Bolt12InvoiceFeatures};
16841684
use super::{FinalOnionHopData, TrampolineOnionPacket};
16851685

16861686
#[allow(unused_imports)]
@@ -1774,7 +1774,10 @@ mod fuzzy_internal_msgs {
17741774
BlindedForward {
17751775
amt_to_forward: u64,
17761776
outgoing_cltv_value: u32,
1777+
// experimental TLV: 66102
17771778
payment_paths: Vec<BlindedPath>,
1779+
// experimental TLV: 66097
1780+
invoice_features: Option<Bolt12InvoiceFeatures>
17781781
},
17791782
}
17801783

@@ -2673,30 +2676,14 @@ impl Writeable for OutboundTrampolinePayload {
26732676
(14, outgoing_node_id, required)
26742677
});
26752678
},
2676-
Self::BlindedForward { encrypted_tlvs, intro_node_blinding_point } => {
2679+
Self::BlindedForward { amt_to_forward, outgoing_cltv_value, payment_paths, invoice_features } => {
26772680
_encode_varint_length_prefixed_tlv!(w, {
2678-
(10, *encrypted_tlvs, required_vec),
2679-
(12, intro_node_blinding_point, option)
2681+
(2, HighZeroBytesDroppedBigSize(*amt_to_forward), required),
2682+
(4, HighZeroBytesDroppedBigSize(*outgoing_cltv_value), required),
2683+
(66097, invoice_features, option),
2684+
(66102, *payment_paths, required_vec)
26802685
});
26812686
},
2682-
Self::BlindedReceive {
2683-
sender_intended_htlc_amt_msat, total_msat, cltv_expiry_height, encrypted_tlvs,
2684-
intro_node_blinding_point, keysend_preimage, ref custom_tlvs,
2685-
} => {
2686-
// We need to update [`ln::outbound_payment::RecipientOnionFields::with_custom_tlvs`]
2687-
// to reject any reserved types in the experimental range if new ones are ever
2688-
// standardized.
2689-
let keysend_tlv = keysend_preimage.map(|preimage| (5482373484, preimage.encode()));
2690-
let mut custom_tlvs: Vec<&(u64, Vec<u8>)> = custom_tlvs.iter().chain(keysend_tlv.iter()).collect();
2691-
custom_tlvs.sort_unstable_by_key(|(typ, _)| *typ);
2692-
_encode_varint_length_prefixed_tlv!(w, {
2693-
(2, HighZeroBytesDroppedBigSize(*sender_intended_htlc_amt_msat), required),
2694-
(4, HighZeroBytesDroppedBigSize(*cltv_expiry_height), required),
2695-
(10, *encrypted_tlvs, required_vec),
2696-
(12, intro_node_blinding_point, option),
2697-
(18, HighZeroBytesDroppedBigSize(*total_msat), required)
2698-
}, custom_tlvs.iter());
2699-
},
27002687
}
27012688
Ok(())
27022689
}

0 commit comments

Comments
 (0)