@@ -7544,6 +7544,7 @@ mod tests {
75447544 use crate::util::config::UserConfig;
75457545 use crate::util::enforcing_trait_impls::EnforcingSigner;
75467546 use crate::util::errors::APIError;
7547+ use crate::util::ser::{Readable, Writeable};
75477548 use crate::util::test_utils;
75487549 use crate::util::test_utils::OnGetShutdownScriptpubkey;
75497550 use bitcoin::secp256k1::{Secp256k1, ecdsa::Signature};
@@ -7555,6 +7556,7 @@ mod tests {
75557556 use bitcoin::PackedLockTime;
75567557 use bitcoin::util::address::WitnessVersion;
75577558 use crate::prelude::*;
7559+ use crate::io;
75587560
75597561 struct TestFeeEstimator {
75607562 fee_est: u32
@@ -7568,7 +7570,7 @@ mod tests {
75687570 #[test]
75697571 fn test_channel_id_new_from_data() {
75707572 let data: [u8; 32] = [2; 32];
7571- let channel_id = ChannelId::from_bytes([2; 32] );
7573+ let channel_id = ChannelId::from_bytes(data.clone() );
75727574 assert_eq!(*channel_id.bytes(), data);
75737575 }
75747576
@@ -7587,6 +7589,19 @@ mod tests {
75877589 assert_ne!(channel_id11, channel_id21);
75887590 }
75897591
7592+ #[test]
7593+ fn test_channel_id_write_read() {
7594+ let data: [u8; 32] = [2; 32];
7595+ let channel_id = ChannelId::from_bytes(data.clone());
7596+
7597+ let mut w = test_utils::TestVecWriter(Vec::new());
7598+ channel_id.write(&mut w).unwrap();
7599+
7600+ let channel_id_2 = ChannelId::read(&mut io::Cursor::new(&w.0)).unwrap();
7601+ assert_eq!(channel_id_2, channel_id);
7602+ assert_eq!(channel_id_2.bytes(), &data);
7603+ }
7604+
75907605 #[test]
75917606 fn test_max_funding_satoshis_no_wumbo() {
75927607 assert_eq!(TOTAL_BITCOIN_SUPPLY_SATOSHIS, 21_000_000 * 100_000_000);
0 commit comments