@@ -5988,9 +5988,7 @@ impl<Signer: Sign> Writeable for Channel<Signer> {
59885988 // `user_id` used to be a single u64 value. In order to remain backwards compatible with
59895989 // versions prior to 0.0.113, the u128 is serialized as two separate u64 values. We write
59905990 // the low bytes now and the optional high bytes later.
5991- let mut low_bytes = [ 0u8 ; 8 ] ;
5992- low_bytes. copy_from_slice ( & self . user_id . to_be_bytes ( ) [ 8 ..16 ] ) ;
5993- let user_id_low = u64:: from_be_bytes ( low_bytes) ;
5991+ let user_id_low = self . user_id as u64 ;
59945992 user_id_low. write ( writer) ?;
59955993
59965994 // Version 1 deserializers expected to read parts of the config object here. Version 2
@@ -6239,9 +6237,7 @@ impl<Signer: Sign> Writeable for Channel<Signer> {
62396237 // `user_id` used to be a single u64 value. In order to remain backwards compatible with
62406238 // versions prior to 0.0.113, the u128 is serialized as two separate u64 values. Therefore,
62416239 // we write the high bytes as an option here.
6242- let mut high_bytes = [ 0u8 ; 8 ] ;
6243- high_bytes. copy_from_slice ( & self . user_id . to_be_bytes ( ) [ 0 ..8 ] ) ;
6244- let user_id_high_opt = Some ( u64:: from_be_bytes ( high_bytes) ) ;
6240+ let user_id_high_opt = Some ( ( self . user_id >> 64 ) as u64 ) ;
62456241
62466242 write_tlv_fields ! ( writer, {
62476243 ( 0 , self . announcement_sigs, option) ,
@@ -6585,12 +6581,11 @@ impl<'a, Signer: Sign, K: Deref> ReadableArgs<(&'a K, u32)> for Channel<Signer>
65856581 // `user_id` used to be a single u64 value. In order to remain backwards
65866582 // compatible with versions prior to 0.0.113, the u128 is serialized as two
65876583 // separate u64 values.
6588- let mut user_id_bytes = [ 0u8 ; 16 ] ;
6589- user_id_bytes[ 8 ..16 ] . copy_from_slice ( & user_id_low. to_be_bytes ( ) ) ;
6590- if let Some ( high_bytes) = user_id_high_opt {
6591- user_id_bytes[ 0 ..8 ] . copy_from_slice ( & high_bytes. to_be_bytes ( ) ) ;
6592- }
6593- let user_id = u128:: from_be_bytes ( user_id_bytes) ;
6584+ let user_id = if let Some ( user_id_high) = user_id_high_opt {
6585+ user_id_low as u128 + ( ( user_id_high as u128 ) << 64 )
6586+ } else {
6587+ user_id_low as u128
6588+ } ;
65946589
65956590 Ok ( Channel {
65966591 user_id,
0 commit comments