@@ -1637,17 +1637,18 @@ impl Readable for QueryShortChannelIds {
16371637 fn read < R : Read > ( r : & mut R ) -> Result < Self , DecodeError > {
16381638 let chain_hash: BlockHash = Readable :: read ( r) ?;
16391639
1640- // We expect the encoding_len to always includes the 1-byte
1641- // encoding_type and that short_channel_ids are 8-bytes each
16421640 let encoding_len: u16 = Readable :: read ( r) ?;
1643- if encoding_len == 0 || ( encoding_len - 1 ) % 8 != 0 {
1644- return Err ( DecodeError :: InvalidValue ) ;
1645- }
1641+ let encoding_type: u8 = Readable :: read ( r) ?;
16461642
16471643 // Must be encoding_type=0 uncompressed serialization. We do not
16481644 // support encoding_type=1 zlib serialization.
1649- let encoding_type: u8 = Readable :: read ( r) ?;
16501645 if encoding_type != EncodingType :: Uncompressed as u8 {
1646+ return Err ( DecodeError :: UnsupportedCompression ) ;
1647+ }
1648+
1649+ // We expect the encoding_len to always includes the 1-byte
1650+ // encoding_type and that short_channel_ids are 8-bytes each
1651+ if encoding_len == 0 || ( encoding_len - 1 ) % 8 != 0 {
16511652 return Err ( DecodeError :: InvalidValue ) ;
16521653 }
16531654
@@ -1749,17 +1750,18 @@ impl Readable for ReplyChannelRange {
17491750 let number_of_blocks: u32 = Readable :: read ( r) ?;
17501751 let sync_complete: bool = Readable :: read ( r) ?;
17511752
1752- // We expect the encoding_len to always includes the 1-byte
1753- // encoding_type and that short_channel_ids are 8-bytes each
17541753 let encoding_len: u16 = Readable :: read ( r) ?;
1755- if encoding_len == 0 || ( encoding_len - 1 ) % 8 != 0 {
1756- return Err ( DecodeError :: InvalidValue ) ;
1757- }
1754+ let encoding_type: u8 = Readable :: read ( r) ?;
17581755
17591756 // Must be encoding_type=0 uncompressed serialization. We do not
17601757 // support encoding_type=1 zlib serialization.
1761- let encoding_type: u8 = Readable :: read ( r) ?;
17621758 if encoding_type != EncodingType :: Uncompressed as u8 {
1759+ return Err ( DecodeError :: UnsupportedCompression ) ;
1760+ }
1761+
1762+ // We expect the encoding_len to always includes the 1-byte
1763+ // encoding_type and that short_channel_ids are 8-bytes each
1764+ if encoding_len == 0 || ( encoding_len - 1 ) % 8 != 0 {
17631765 return Err ( DecodeError :: InvalidValue ) ;
17641766 }
17651767
0 commit comments