diff --git a/bitcoin-test-utils/src/lib.rs b/bitcoin-test-utils/src/lib.rs index d79cfaf1..165a54d2 100644 --- a/bitcoin-test-utils/src/lib.rs +++ b/bitcoin-test-utils/src/lib.rs @@ -42,8 +42,7 @@ pub fn from_hex(hex: &str, target: &mut [u8]) -> Result { /// Transforms an hex string to a Vec. /// Panics if the string is not valid hex. pub fn str_to_hex(hex_str: &str) -> Vec { - let mut hex = Vec::::new(); - hex.resize(hex_str.len() / 2, 0); + let mut hex = vec![0; hex_str.len() / 2]; from_hex(hex_str, &mut hex).unwrap(); hex } diff --git a/dlc-manager/src/manager.rs b/dlc-manager/src/manager.rs index 78883c6c..9614da1f 100644 --- a/dlc-manager/src/manager.rs +++ b/dlc-manager/src/manager.rs @@ -129,7 +129,13 @@ macro_rules! check_for_timed_out_channels { let is_timed_out = timeout < $manager.time.unix_time_now(); if is_timed_out { let sub_channel = if channel.is_sub_channel() { - unimplemented!(); + log::info!( + "Skipping force-closure of subchannel {}: not supported", + bitcoin::hashes::hex::ToHex::to_hex(&channel.channel_id[..]) + ); + continue; + + // TODO: Implement subchannel force closing // let s = get_sub_channel_in_state!( // $manager, // channel.channel_id, diff --git a/dlc-messages/src/message_handler.rs b/dlc-messages/src/message_handler.rs index 30def1c4..d7dd8491 100644 --- a/dlc-messages/src/message_handler.rs +++ b/dlc-messages/src/message_handler.rs @@ -188,9 +188,7 @@ impl CustomMessageHandler for MessageHandler { org: &PublicKey, ) -> Result<(), LightningError> { let mut segment_readers = self.segment_readers.lock().unwrap(); - let segment_reader = segment_readers - .entry(*org) - .or_insert_with(SegmentReader::new); + let segment_reader = segment_readers.entry(*org).or_default(); if segment_reader.expecting_chunk() { match msg {