@@ -54,7 +54,7 @@ use crate::ln::wire::Encode;
5454use crate :: chain:: keysinterface:: { Sign , KeysInterface , KeysManager , Recipient } ;
5555use crate :: util:: config:: { UserConfig , ChannelConfig } ;
5656use crate :: util:: events:: { Event , EventHandler , EventsProvider , MessageSendEvent , MessageSendEventsProvider , ClosureReason , HTLCDestination } ;
57- use crate :: util:: { byte_utils , events} ;
57+ use crate :: util:: events;
5858use crate :: util:: wakers:: { Future , Notifier } ;
5959use crate :: util:: scid_utils:: fake_scid;
6060use crate :: util:: ser:: { BigSize , FixedLengthReader , Readable , ReadableArgs , MaybeReadable , Writeable , Writer , VecWriter } ;
@@ -2053,7 +2053,7 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
20532053 return Err ( ReceiveError {
20542054 msg : "Upstream node set CLTV to the wrong value" ,
20552055 err_code : 18 ,
2056- err_data : byte_utils :: be32_to_array ( cltv_expiry) . to_vec ( )
2056+ err_data : cltv_expiry. to_be_bytes ( ) . to_vec ( )
20572057 } )
20582058 }
20592059 // final_expiry_too_soon
@@ -2072,7 +2072,7 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
20722072 if hop_data. amt_to_forward > amt_msat {
20732073 return Err ( ReceiveError {
20742074 err_code : 19 ,
2075- err_data : byte_utils :: be64_to_array ( amt_msat) . to_vec ( ) ,
2075+ err_data : amt_msat. to_be_bytes ( ) . to_vec ( ) ,
20762076 msg : "Upstream node sent less than we were supposed to receive in payment" ,
20772077 } ) ;
20782078 }
@@ -3451,9 +3451,9 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
34513451
34523452 macro_rules! fail_htlc {
34533453 ( $htlc: expr, $payment_hash: expr) => {
3454- let mut htlc_msat_height_data = byte_utils :: be64_to_array ( $htlc. value) . to_vec( ) ;
3454+ let mut htlc_msat_height_data = $htlc. value. to_be_bytes ( ) . to_vec( ) ;
34553455 htlc_msat_height_data. extend_from_slice(
3456- & byte_utils :: be32_to_array ( self . best_block. read( ) . unwrap( ) . height( ) ) ,
3456+ & self . best_block. read( ) . unwrap( ) . height( ) . to_be_bytes ( ) ,
34573457 ) ;
34583458 failed_forwards. push( ( HTLCSource :: PreviousHopData ( HTLCPreviousHopData {
34593459 short_channel_id: $htlc. prev_hop. short_channel_id,
@@ -3909,9 +3909,8 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
39093909 let removed_source = self . claimable_htlcs . lock ( ) . unwrap ( ) . remove ( payment_hash) ;
39103910 if let Some ( ( _, mut sources) ) = removed_source {
39113911 for htlc in sources. drain ( ..) {
3912- let mut htlc_msat_height_data = byte_utils:: be64_to_array ( htlc. value ) . to_vec ( ) ;
3913- htlc_msat_height_data. extend_from_slice ( & byte_utils:: be32_to_array (
3914- self . best_block . read ( ) . unwrap ( ) . height ( ) ) ) ;
3912+ let mut htlc_msat_height_data = htlc. value . to_be_bytes ( ) . to_vec ( ) ;
3913+ htlc_msat_height_data. extend_from_slice ( & self . best_block . read ( ) . unwrap ( ) . height ( ) . to_be_bytes ( ) ) ;
39153914 let source = HTLCSource :: PreviousHopData ( htlc. prev_hop ) ;
39163915 let reason = HTLCFailReason :: reason ( 0x4000 | 15 , htlc_msat_height_data) ;
39173916 let receiver = HTLCDestination :: FailedPayment { payment_hash : * payment_hash } ;
@@ -4306,9 +4305,8 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
43064305 mem:: drop ( channel_state_lock) ;
43074306 if !valid_mpp {
43084307 for htlc in sources. drain ( ..) {
4309- let mut htlc_msat_height_data = byte_utils:: be64_to_array ( htlc. value ) . to_vec ( ) ;
4310- htlc_msat_height_data. extend_from_slice ( & byte_utils:: be32_to_array (
4311- self . best_block . read ( ) . unwrap ( ) . height ( ) ) ) ;
4308+ let mut htlc_msat_height_data = htlc. value . to_be_bytes ( ) . to_vec ( ) ;
4309+ htlc_msat_height_data. extend_from_slice ( & self . best_block . read ( ) . unwrap ( ) . height ( ) . to_be_bytes ( ) ) ;
43124310 let source = HTLCSource :: PreviousHopData ( htlc. prev_hop ) ;
43134311 let reason = HTLCFailReason :: reason ( 0x4000 | 15 , htlc_msat_height_data) ;
43144312 let receiver = HTLCDestination :: FailedPayment { payment_hash } ;
@@ -6283,8 +6281,8 @@ where
62836281 // number of blocks we generally consider it to take to do a commitment update,
62846282 // just give up on it and fail the HTLC.
62856283 if height >= htlc. cltv_expiry - HTLC_FAIL_BACK_BUFFER {
6286- let mut htlc_msat_height_data = byte_utils :: be64_to_array ( htlc. value ) . to_vec ( ) ;
6287- htlc_msat_height_data. extend_from_slice ( & byte_utils :: be32_to_array ( height) ) ;
6284+ let mut htlc_msat_height_data = htlc. value . to_be_bytes ( ) . to_vec ( ) ;
6285+ htlc_msat_height_data. extend_from_slice ( & height. to_be_bytes ( ) ) ;
62886286
62896287 timed_out_htlcs. push ( ( HTLCSource :: PreviousHopData ( htlc. prev_hop . clone ( ) ) , payment_hash. clone ( ) ,
62906288 HTLCFailReason :: reason ( 0x4000 | 15 , htlc_msat_height_data) ,
0 commit comments