Skip to content

Commit

Permalink
Only write BlindedHopFeatures if any features are set.
Browse files Browse the repository at this point in the history
Minor space-saving optimization.
  • Loading branch information
valentinewallace committed Mar 19, 2024
1 parent b747b39 commit caccb1c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lightning/src/blinded_path/payment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,14 @@ impl TryFrom<CounterpartyForwardingInfo> for PaymentRelay {

impl Writeable for ForwardTlvs {
fn write<W: Writer>(&self, w: &mut W) -> Result<(), io::Error> {
let features_opt =
if self.features == BlindedHopFeatures::empty() { None }
else { Some(&self.features) };
encode_tlv_stream!(w, {
(2, self.short_channel_id, required),
(10, self.payment_relay, required),
(12, self.payment_constraints, required),
(14, self.features, required)
(14, features_opt, option)
});
Ok(())
}
Expand Down

0 comments on commit caccb1c

Please sign in to comment.