Skip to content

Commit 16d1ba1

Browse files
committed
Serialize blinded path forwards in Trampoline onions.
1 parent 07f3380 commit 16d1ba1

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

lightning/src/ln/msgs.rs

+23-4
Original file line numberDiff line numberDiff line change
@@ -1677,9 +1677,10 @@ pub struct FinalOnionHopData {
16771677

16781678
mod fuzzy_internal_msgs {
16791679
use bitcoin::secp256k1::PublicKey;
1680+
use crate::blinded_path::BlindedPath;
16801681
use crate::blinded_path::payment::{PaymentConstraints, PaymentContext, PaymentRelay};
16811682
use crate::ln::types::{PaymentPreimage, PaymentSecret};
1682-
use crate::ln::features::BlindedHopFeatures;
1683+
use crate::ln::features::{BlindedHopFeatures, Bolt12InvoiceFeatures};
16831684
use super::{FinalOnionHopData, TrampolineOnionPacket};
16841685

16851686
#[allow(unused_imports)]
@@ -1766,9 +1767,19 @@ mod fuzzy_internal_msgs {
17661767
/// The value, in msat, of the payment after this hop's fee is deducted.
17671768
amt_to_forward: u64,
17681769
outgoing_cltv_value: u32,
1769-
/// The node id to which the trampoline node must find a route
1770+
/// The node id to which the trampoline node must find a route.
17701771
outgoing_node_id: PublicKey,
1771-
}
1772+
},
1773+
#[allow(unused)]
1774+
BlindedForward {
1775+
/// The value, in msat, of the payment after this hop's fee is deducted.
1776+
amt_to_forward: u64,
1777+
outgoing_cltv_value: u32,
1778+
/// List of blinded path options the last trampoline hop may choose to route through.
1779+
payment_paths: Vec<BlindedPath>,
1780+
/// If applicable, features of the BOLT12 invoice being paid.
1781+
invoice_features: Option<Bolt12InvoiceFeatures>
1782+
},
17721783
}
17731784

17741785
pub struct DecodedOnionErrorPacket {
@@ -2665,7 +2676,15 @@ impl Writeable for OutboundTrampolinePayload {
26652676
(4, HighZeroBytesDroppedBigSize(*outgoing_cltv_value), required),
26662677
(14, outgoing_node_id, required)
26672678
});
2668-
}
2679+
},
2680+
Self::BlindedForward { amt_to_forward, outgoing_cltv_value, payment_paths, invoice_features } => {
2681+
_encode_varint_length_prefixed_tlv!(w, {
2682+
(2, HighZeroBytesDroppedBigSize(*amt_to_forward), required),
2683+
(4, HighZeroBytesDroppedBigSize(*outgoing_cltv_value), required),
2684+
(66097, invoice_features, option),
2685+
(66102, *payment_paths, required_vec)
2686+
});
2687+
},
26692688
}
26702689
Ok(())
26712690
}

0 commit comments

Comments
 (0)