@@ -7531,6 +7531,7 @@ mod tests {
75317531 use crate::util::config::UserConfig;
75327532 use crate::util::enforcing_trait_impls::EnforcingSigner;
75337533 use crate::util::errors::APIError;
7534+ use crate::util::ser::{Readable, Writeable};
75347535 use crate::util::test_utils;
75357536 use crate::util::test_utils::OnGetShutdownScriptpubkey;
75367537 use bitcoin::secp256k1::{Secp256k1, ecdsa::Signature};
@@ -7542,6 +7543,7 @@ mod tests {
75427543 use bitcoin::PackedLockTime;
75437544 use bitcoin::util::address::WitnessVersion;
75447545 use crate::prelude::*;
7546+ use crate::io;
75457547
75467548 struct TestFeeEstimator {
75477549 fee_est: u32
@@ -7555,7 +7557,7 @@ mod tests {
75557557 #[test]
75567558 fn test_channel_id_new_from_data() {
75577559 let data: [u8; 32] = [2; 32];
7558- let channel_id = ChannelId::from_bytes([2; 32] );
7560+ let channel_id = ChannelId::from_bytes(data.clone() );
75597561 assert_eq!(*channel_id.bytes(), data);
75607562 }
75617563
@@ -7574,6 +7576,19 @@ mod tests {
75747576 assert_ne!(channel_id11, channel_id21);
75757577 }
75767578
7579+ #[test]
7580+ fn test_channel_id_write_read() {
7581+ let data: [u8; 32] = [2; 32];
7582+ let channel_id = ChannelId::from_bytes(data.clone());
7583+
7584+ let mut w = test_utils::TestVecWriter(Vec::new());
7585+ channel_id.write(&mut w).unwrap();
7586+
7587+ let channel_id_2 = ChannelId::read(&mut io::Cursor::new(&w.0)).unwrap();
7588+ assert_eq!(channel_id_2, channel_id);
7589+ assert_eq!(channel_id_2.bytes(), &data);
7590+ }
7591+
75777592 #[test]
75787593 fn test_max_funding_satoshis_no_wumbo() {
75797594 assert_eq!(TOTAL_BITCOIN_SUPPLY_SATOSHIS, 21_000_000 * 100_000_000);
0 commit comments