@@ -6005,9 +6005,7 @@ impl<Signer: Sign> Writeable for Channel<Signer> {
60056005 // `user_id` used to be a single u64 value. In order to remain backwards compatible with
60066006 // versions prior to 0.0.113, the u128 is serialized as two separate u64 values. We write
60076007 // 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 ;
60116009 user_id_low. write ( writer) ?;
60126010
60136011 // 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> {
62586256 // `user_id` used to be a single u64 value. In order to remain backwards compatible with
62596257 // versions prior to 0.0.113, the u128 is serialized as two separate u64 values. Therefore,
62606258 // 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 ) ;
62646260
62656261 write_tlv_fields ! ( writer, {
62666262 ( 0 , self . announcement_sigs, option) ,
@@ -6607,12 +6603,11 @@ impl<'a, Signer: Sign, K: Deref> ReadableArgs<(&'a K, u32)> for Channel<Signer>
66076603 // `user_id` used to be a single u64 value. In order to remain backwards
66086604 // compatible with versions prior to 0.0.113, the u128 is serialized as two
66096605 // 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+ } ;
66166611
66176612 Ok ( Channel {
66186613 user_id,
0 commit comments