Skip to content

Commit 5074acc

Browse files
committed
Implement Writeable for TrampolineForwardTlvs
We will need the ability to serialize blinded Trampoline forwards in the future, including for unit tests.
1 parent 09ffa57 commit 5074acc

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Diff for: lightning/src/blinded_path/payment.rs

+18
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,24 @@ impl Writeable for ForwardTlvs {
514514
}
515515
}
516516

517+
#[cfg(trampoline)]
518+
impl Writeable for TrampolineForwardTlvs {
519+
fn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {
520+
let features_opt = if self.features == BlindedHopFeatures::empty() {
521+
None
522+
} else {
523+
Some(WithoutLength(&self.features))
524+
};
525+
encode_tlv_stream!(w, {
526+
(4, self.next_trampoline, required),
527+
(10, self.payment_relay, required),
528+
(12, self.payment_constraints, required),
529+
(14, features_opt, option)
530+
});
531+
Ok(())
532+
}
533+
}
534+
517535
impl Writeable for ReceiveTlvs {
518536
fn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {
519537
encode_tlv_stream!(w, {

0 commit comments

Comments
 (0)