@@ -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 } ;
@@ -2041,7 +2041,7 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
20412041 return Err ( ReceiveError {
20422042 msg : "Upstream node set CLTV to the wrong value" ,
20432043 err_code : 18 ,
2044- err_data : byte_utils :: be32_to_array ( cltv_expiry) . to_vec ( )
2044+ err_data : cltv_expiry. to_be_bytes ( ) . to_vec ( )
20452045 } )
20462046 }
20472047 // final_expiry_too_soon
@@ -2060,7 +2060,7 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
20602060 if hop_data. amt_to_forward > amt_msat {
20612061 return Err ( ReceiveError {
20622062 err_code : 19 ,
2063- err_data : byte_utils :: be64_to_array ( amt_msat) . to_vec ( ) ,
2063+ err_data : amt_msat. to_be_bytes ( ) . to_vec ( ) ,
20642064 msg : "Upstream node sent less than we were supposed to receive in payment" ,
20652065 } ) ;
20662066 }
@@ -3439,9 +3439,9 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
34393439
34403440 macro_rules! fail_htlc {
34413441 ( $htlc: expr, $payment_hash: expr) => {
3442- let mut htlc_msat_height_data = byte_utils :: be64_to_array ( $htlc. value) . to_vec( ) ;
3442+ let mut htlc_msat_height_data = $htlc. value. to_be_bytes ( ) . to_vec( ) ;
34433443 htlc_msat_height_data. extend_from_slice(
3444- & byte_utils :: be32_to_array ( self . best_block. read( ) . unwrap( ) . height( ) ) ,
3444+ & self . best_block. read( ) . unwrap( ) . height( ) . to_be_bytes ( ) ,
34453445 ) ;
34463446 failed_forwards. push( ( HTLCSource :: PreviousHopData ( HTLCPreviousHopData {
34473447 short_channel_id: $htlc. prev_hop. short_channel_id,
@@ -3895,9 +3895,8 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
38953895 let removed_source = self . claimable_htlcs . lock ( ) . unwrap ( ) . remove ( payment_hash) ;
38963896 if let Some ( ( _, mut sources) ) = removed_source {
38973897 for htlc in sources. drain ( ..) {
3898- let mut htlc_msat_height_data = byte_utils:: be64_to_array ( htlc. value ) . to_vec ( ) ;
3899- htlc_msat_height_data. extend_from_slice ( & byte_utils:: be32_to_array (
3900- self . best_block . read ( ) . unwrap ( ) . height ( ) ) ) ;
3898+ let mut htlc_msat_height_data = htlc. value . to_be_bytes ( ) . to_vec ( ) ;
3899+ htlc_msat_height_data. extend_from_slice ( & self . best_block . read ( ) . unwrap ( ) . height ( ) . to_be_bytes ( ) ) ;
39013900 self . fail_htlc_backwards_internal (
39023901 HTLCSource :: PreviousHopData ( htlc. prev_hop ) , payment_hash,
39033902 HTLCFailReason :: Reason { failure_code : 0x4000 | 15 , data : htlc_msat_height_data } ,
@@ -4291,9 +4290,8 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
42914290 mem:: drop ( channel_state_lock) ;
42924291 if !valid_mpp {
42934292 for htlc in sources. drain ( ..) {
4294- let mut htlc_msat_height_data = byte_utils:: be64_to_array ( htlc. value ) . to_vec ( ) ;
4295- htlc_msat_height_data. extend_from_slice ( & byte_utils:: be32_to_array (
4296- self . best_block . read ( ) . unwrap ( ) . height ( ) ) ) ;
4293+ let mut htlc_msat_height_data = htlc. value . to_be_bytes ( ) . to_vec ( ) ;
4294+ htlc_msat_height_data. extend_from_slice ( & self . best_block . read ( ) . unwrap ( ) . height ( ) . to_be_bytes ( ) ) ;
42974295 self . fail_htlc_backwards_internal (
42984296 HTLCSource :: PreviousHopData ( htlc. prev_hop ) , & payment_hash,
42994297 HTLCFailReason :: Reason { failure_code : 0x4000 |15 , data : htlc_msat_height_data } ,
@@ -6267,8 +6265,8 @@ where
62676265 // number of blocks we generally consider it to take to do a commitment update,
62686266 // just give up on it and fail the HTLC.
62696267 if height >= htlc. cltv_expiry - HTLC_FAIL_BACK_BUFFER {
6270- let mut htlc_msat_height_data = byte_utils :: be64_to_array ( htlc. value ) . to_vec ( ) ;
6271- htlc_msat_height_data. extend_from_slice ( & byte_utils :: be32_to_array ( height) ) ;
6268+ let mut htlc_msat_height_data = htlc. value . to_be_bytes ( ) . to_vec ( ) ;
6269+ htlc_msat_height_data. extend_from_slice ( & height. to_be_bytes ( ) ) ;
62726270 timed_out_htlcs. push ( ( HTLCSource :: PreviousHopData ( htlc. prev_hop . clone ( ) ) , payment_hash. clone ( ) , HTLCFailReason :: Reason {
62736271 failure_code : 0x4000 | 15 ,
62746272 data : htlc_msat_height_data
0 commit comments