@@ -1637,17 +1637,18 @@ impl Readable for QueryShortChannelIds {
1637
1637
fn read < R : Read > ( r : & mut R ) -> Result < Self , DecodeError > {
1638
1638
let chain_hash: BlockHash = Readable :: read ( r) ?;
1639
1639
1640
- // We expect the encoding_len to always includes the 1-byte
1641
- // encoding_type and that short_channel_ids are 8-bytes each
1642
1640
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) ?;
1646
1642
1647
1643
// Must be encoding_type=0 uncompressed serialization. We do not
1648
1644
// support encoding_type=1 zlib serialization.
1649
- let encoding_type: u8 = Readable :: read ( r) ?;
1650
1645
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 {
1651
1652
return Err ( DecodeError :: InvalidValue ) ;
1652
1653
}
1653
1654
@@ -1749,17 +1750,18 @@ impl Readable for ReplyChannelRange {
1749
1750
let number_of_blocks: u32 = Readable :: read ( r) ?;
1750
1751
let sync_complete: bool = Readable :: read ( r) ?;
1751
1752
1752
- // We expect the encoding_len to always includes the 1-byte
1753
- // encoding_type and that short_channel_ids are 8-bytes each
1754
1753
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) ?;
1758
1755
1759
1756
// Must be encoding_type=0 uncompressed serialization. We do not
1760
1757
// support encoding_type=1 zlib serialization.
1761
- let encoding_type: u8 = Readable :: read ( r) ?;
1762
1758
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 {
1763
1765
return Err ( DecodeError :: InvalidValue ) ;
1764
1766
}
1765
1767
0 commit comments