diff --git a/src/fiber/channel.rs b/src/fiber/channel.rs index 90499355..988b4dcd 100644 --- a/src/fiber/channel.rs +++ b/src/fiber/channel.rs @@ -2295,11 +2295,6 @@ enum CommitmentSignedFlags { } #[derive(Copy, Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] -#[serde( - rename_all = "SCREAMING_SNAKE_CASE", - tag = "state_name", - content = "state_flags" -)] pub enum ChannelState { /// We are negotiating the parameters required for the channel prior to funding it. NegotiatingFunding(NegotiatingFundingFlags), diff --git a/src/tests/store.rs b/src/tests/store.rs index bd5ef618..3789b5c8 100644 --- a/src/tests/store.rs +++ b/src/tests/store.rs @@ -1,3 +1,6 @@ +use crate::fiber::channel::AwaitingChannelReadyFlags; +use crate::fiber::channel::ChannelState; +use crate::fiber::channel::SigningCommitmentFlags; use crate::fiber::config::AnnouncedNodeName; use crate::fiber::graph::ChannelInfo; use crate::fiber::graph::NetworkGraphStateStore; @@ -224,3 +227,16 @@ fn test_store_wacthtower() { store.remove_watch_channel(channel_id); assert_eq!(store.get_watch_channels(), vec![]); } + +#[test] +fn test_channel_state_serialize() { + let state = ChannelState::AwaitingChannelReady(AwaitingChannelReadyFlags::CHANNEL_READY); + let bincode_encoded = bincode::serialize(&state).unwrap(); + let new_state: ChannelState = bincode::deserialize(&bincode_encoded).unwrap(); + assert_eq!(state, new_state); + + let flags = SigningCommitmentFlags::COMMITMENT_SIGNED_SENT; + let bincode_encoded = bincode::serialize(&flags).unwrap(); + let new_flags: SigningCommitmentFlags = bincode::deserialize(&bincode_encoded).unwrap(); + assert_eq!(flags, new_flags); +}