@@ -1637,20 +1637,22 @@ 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 :: ZlibCompressedUnsupported ) ;
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
1655
+
1654
1656
// Read short_channel_ids (8-bytes each), for the u16 encoding_len
1655
1657
// less the 1-byte encoding_type
1656
1658
let short_channel_id_count: u16 = ( encoding_len - 1 ) /8 ;
@@ -1749,20 +1751,22 @@ impl Readable for ReplyChannelRange {
1749
1751
let number_of_blocks: u32 = Readable :: read ( r) ?;
1750
1752
let sync_complete: bool = Readable :: read ( r) ?;
1751
1753
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
1754
let encoding_len: u16 = Readable :: read ( r) ?;
1755
- if encoding_len == 0 || ( encoding_len - 1 ) % 8 != 0 {
1756
- return Err ( DecodeError :: InvalidValue ) ;
1757
- }
1755
+ let encoding_type: u8 = Readable :: read ( r) ?;
1758
1756
1759
1757
// Must be encoding_type=0 uncompressed serialization. We do not
1760
1758
// support encoding_type=1 zlib serialization.
1761
- let encoding_type: u8 = Readable :: read ( r) ?;
1762
1759
if encoding_type != EncodingType :: Uncompressed as u8 {
1760
+ return Err ( DecodeError :: ZlibCompressedUnsupported ) ;
1761
+ }
1762
+
1763
+ // We expect the encoding_len to always includes the 1-byte
1764
+ // encoding_type and that short_channel_ids are 8-bytes each
1765
+ if encoding_len == 0 || ( encoding_len - 1 ) % 8 != 0 {
1763
1766
return Err ( DecodeError :: InvalidValue ) ;
1764
1767
}
1765
1768
1769
+
1766
1770
// Read short_channel_ids (8-bytes each), for the u16 encoding_len
1767
1771
// less the 1-byte encoding_type
1768
1772
let short_channel_id_count: u16 = ( encoding_len - 1 ) /8 ;
0 commit comments