@@ -1744,16 +1744,12 @@ impl<R: ::std::io::Read> Readable<R> for ChannelReestablish{
1744
1744
next_local_commitment_number : Readable :: read ( r) ?,
1745
1745
next_remote_commitment_number : Readable :: read ( r) ?,
1746
1746
data_loss_protect : {
1747
- let mut buf = [ 0 ; 32 +33 ] ;
1748
- match r. read_exact ( & mut buf) {
1749
- Ok ( ( ) ) => Some ( DataLossProtect {
1750
- your_last_per_commitment_secret : {
1751
- let mut a: [ u8 ; 32 ] = Default :: default ( ) ;
1752
- a. copy_from_slice ( & buf[ ..32 ] ) ;
1753
- a
1754
- } ,
1755
- my_current_per_commitment_point : secp_pubkey ! ( & Secp256k1 :: without_caps( ) , & buf[ 32 ..] ) ,
1756
- } ) ,
1747
+ match <[ u8 ; 32 ] as Readable < R > >:: read ( r) {
1748
+ Ok ( your_last_per_commitment_secret) =>
1749
+ Some ( DataLossProtect {
1750
+ your_last_per_commitment_secret,
1751
+ my_current_per_commitment_point : Readable :: read ( r) ?,
1752
+ } ) ,
1757
1753
Err ( DecodeError :: ShortRead ) => None ,
1758
1754
Err ( e) => return Err ( e)
1759
1755
}
@@ -1893,11 +1889,7 @@ impl<R: ::std::io::Read> Readable<R> for OnionPacket {
1893
1889
r. read_exact ( & mut buf) ?;
1894
1890
PublicKey :: from_slice ( & Secp256k1 :: without_caps ( ) , & buf)
1895
1891
} ,
1896
- hop_data : {
1897
- let mut buf = [ 0u8 ; 20 * 65 ] ;
1898
- r. read_exact ( & mut buf) ?;
1899
- buf
1900
- } ,
1892
+ hop_data : Readable :: read ( r) ?,
1901
1893
hmac : Readable :: read ( r) ?,
1902
1894
} )
1903
1895
}
0 commit comments