Skip to content

Commit 2611741

Browse files
committed
Serialize blinded path forwards in Trampoline onions.
1 parent 66fb520 commit 2611741

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

lightning/src/ln/msgs.rs

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1746,9 +1746,10 @@ pub struct FinalOnionHopData {
17461746

17471747
mod fuzzy_internal_msgs {
17481748
use bitcoin::secp256k1::PublicKey;
1749+
use crate::blinded_path::BlindedPath;
17491750
use crate::blinded_path::payment::{PaymentConstraints, PaymentContext, PaymentRelay};
17501751
use crate::ln::types::{PaymentPreimage, PaymentSecret};
1751-
use crate::ln::features::BlindedHopFeatures;
1752+
use crate::ln::features::{BlindedHopFeatures, Bolt12InvoiceFeatures};
17521753
use super::{FinalOnionHopData, TrampolineOnionPacket};
17531754

17541755
#[allow(unused_imports)]
@@ -1836,9 +1837,19 @@ mod fuzzy_internal_msgs {
18361837
/// The value, in msat, of the payment after this hop's fee is deducted.
18371838
amt_to_forward: u64,
18381839
outgoing_cltv_value: u32,
1839-
/// The node id to which the trampoline node must find a route
1840+
/// The node id to which the trampoline node must find a route.
18401841
outgoing_node_id: PublicKey,
1841-
}
1842+
},
1843+
#[allow(unused)]
1844+
BlindedForward {
1845+
/// The value, in msat, of the payment after this hop's fee is deducted.
1846+
amt_to_forward: u64,
1847+
outgoing_cltv_value: u32,
1848+
/// List of blinded path options the last trampoline hop may choose to route through.
1849+
payment_paths: Vec<BlindedPath>,
1850+
/// If applicable, features of the BOLT12 invoice being paid.
1851+
invoice_features: Option<Bolt12InvoiceFeatures>
1852+
},
18421853
}
18431854

18441855
pub struct DecodedOnionErrorPacket {
@@ -2763,7 +2774,15 @@ impl Writeable for OutboundTrampolinePayload {
27632774
(4, HighZeroBytesDroppedBigSize(*outgoing_cltv_value), required),
27642775
(14, outgoing_node_id, required)
27652776
});
2766-
}
2777+
},
2778+
Self::BlindedForward { amt_to_forward, outgoing_cltv_value, payment_paths, invoice_features } => {
2779+
_encode_varint_length_prefixed_tlv!(w, {
2780+
(2, HighZeroBytesDroppedBigSize(*amt_to_forward), required),
2781+
(4, HighZeroBytesDroppedBigSize(*outgoing_cltv_value), required),
2782+
(66097, invoice_features, option),
2783+
(66102, *payment_paths, required_vec)
2784+
});
2785+
},
27672786
}
27682787
Ok(())
27692788
}

0 commit comments

Comments
 (0)