@@ -6005,9 +6005,7 @@ impl<Signer: Sign> Writeable for Channel<Signer> {
6005
6005
// `user_id` used to be a single u64 value. In order to remain backwards compatible with
6006
6006
// versions prior to 0.0.113, the u128 is serialized as two separate u64 values. We write
6007
6007
// the low bytes now and the optional high bytes later.
6008
- let mut low_bytes = [ 0u8 ; 8 ] ;
6009
- low_bytes. copy_from_slice ( & self . user_id . to_be_bytes ( ) [ 8 ..16 ] ) ;
6010
- let user_id_low = u64:: from_be_bytes ( low_bytes) ;
6008
+ let user_id_low = self . user_id as u64 ;
6011
6009
user_id_low. write ( writer) ?;
6012
6010
6013
6011
// Version 1 deserializers expected to read parts of the config object here. Version 2
@@ -6258,9 +6256,7 @@ impl<Signer: Sign> Writeable for Channel<Signer> {
6258
6256
// `user_id` used to be a single u64 value. In order to remain backwards compatible with
6259
6257
// versions prior to 0.0.113, the u128 is serialized as two separate u64 values. Therefore,
6260
6258
// we write the high bytes as an option here.
6261
- let mut high_bytes = [ 0u8 ; 8 ] ;
6262
- high_bytes. copy_from_slice ( & self . user_id . to_be_bytes ( ) [ 0 ..8 ] ) ;
6263
- let user_id_high_opt = Some ( u64:: from_be_bytes ( high_bytes) ) ;
6259
+ let user_id_high_opt = Some ( ( self . user_id >> 64 ) as u64 ) ;
6264
6260
6265
6261
write_tlv_fields ! ( writer, {
6266
6262
( 0 , self . announcement_sigs, option) ,
@@ -6607,12 +6603,11 @@ impl<'a, Signer: Sign, K: Deref> ReadableArgs<(&'a K, u32)> for Channel<Signer>
6607
6603
// `user_id` used to be a single u64 value. In order to remain backwards
6608
6604
// compatible with versions prior to 0.0.113, the u128 is serialized as two
6609
6605
// separate u64 values.
6610
- let mut user_id_bytes = [ 0u8 ; 16 ] ;
6611
- user_id_bytes[ 8 ..16 ] . copy_from_slice ( & user_id_low. to_be_bytes ( ) ) ;
6612
- if let Some ( high_bytes) = user_id_high_opt {
6613
- user_id_bytes[ 0 ..8 ] . copy_from_slice ( & high_bytes. to_be_bytes ( ) ) ;
6614
- }
6615
- let user_id = u128:: from_be_bytes ( user_id_bytes) ;
6606
+ let user_id = if let Some ( user_id_high) = user_id_high_opt {
6607
+ user_id_low as u128 + ( ( user_id_high as u128 ) << 64 )
6608
+ } else {
6609
+ user_id_low as u128
6610
+ } ;
6616
6611
6617
6612
Ok ( Channel {
6618
6613
user_id,
0 commit comments