Skip to content

Commit ea80ce1

Browse files
committed
Decode as required option
1 parent c554e64 commit ea80ce1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lightning/src/routing/gossip.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -643,12 +643,12 @@ impl Writeable for ChannelUpdateInfo {
643643
}
644644
}
645645

646-
struct ChannelUpdateInfoDeserWrap(ChannelUpdateInfo);
646+
struct ChannelUpdateInfoDeserWrap(Option<ChannelUpdateInfo>);
647647

648648
impl MaybeReadable for ChannelUpdateInfoDeserWrap {
649649
fn read<R: io::Read>(reader: &mut R) -> Result<Option<Self>, DecodeError> {
650-
if let Ok(channel_update) = ::util::ser::Readable::read(reader) {
651-
Ok(Some(Self(channel_update)))
650+
if let Ok(channel_update_option) = ::util::ser::Readable::read(reader) {
651+
Ok(Some(Self(channel_update_option)))
652652
} else {
653653
Ok(None)
654654
}
@@ -808,9 +808,9 @@ impl Readable for ChannelInfo {
808808
Ok(ChannelInfo {
809809
features: init_tlv_based_struct_field!(features, required),
810810
node_one: init_tlv_based_struct_field!(node_one, required),
811-
one_to_two: one_to_two_wrap.map(|w| w.0),
811+
one_to_two: one_to_two_wrap.map(|w| w.0).unwrap_or(None),
812812
node_two: init_tlv_based_struct_field!(node_two, required),
813-
two_to_one: two_to_one_wrap.map(|w| w.0),
813+
two_to_one: two_to_one_wrap.map(|w| w.0).unwrap_or(None),
814814
capacity_sats: init_tlv_based_struct_field!(capacity_sats, required),
815815
announcement_message: init_tlv_based_struct_field!(announcement_message, required),
816816
announcement_received_time: init_tlv_based_struct_field!(announcement_received_time, (default_value, 0)),

0 commit comments

Comments
 (0)