@@ -5988,9 +5988,7 @@ impl<Signer: Sign> Writeable for Channel<Signer> {
5988
5988
// `user_id` used to be a single u64 value. In order to remain backwards compatible with
5989
5989
// versions prior to 0.0.113, the u128 is serialized as two separate u64 values. We write
5990
5990
// 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 ;
5994
5992
user_id_low. write ( writer) ?;
5995
5993
5996
5994
// 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> {
6239
6237
// `user_id` used to be a single u64 value. In order to remain backwards compatible with
6240
6238
// versions prior to 0.0.113, the u128 is serialized as two separate u64 values. Therefore,
6241
6239
// 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 ) ;
6245
6241
6246
6242
write_tlv_fields ! ( writer, {
6247
6243
( 0 , self . announcement_sigs, option) ,
@@ -6585,12 +6581,11 @@ impl<'a, Signer: Sign, K: Deref> ReadableArgs<(&'a K, u32)> for Channel<Signer>
6585
6581
// `user_id` used to be a single u64 value. In order to remain backwards
6586
6582
// compatible with versions prior to 0.0.113, the u128 is serialized as two
6587
6583
// 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
+ } ;
6594
6589
6595
6590
Ok ( Channel {
6596
6591
user_id,
0 commit comments