Stop writing signer data as a part of channels
[rust-lightning] / lightning / src / sign / type_resolver.rs
1 use crate::sign::{ChannelSigner, EcdsaChannelSigner};
2
3 pub(crate) enum ChannelSignerType<ECS: EcdsaChannelSigner> {
4         // in practice, this will only ever be an EcdsaChannelSigner (specifically, Writeable)
5         Ecdsa(ECS)
6 }
7
8 impl<ECS: EcdsaChannelSigner> ChannelSignerType<ECS>{
9         pub(crate) fn as_ref(&self) -> &dyn ChannelSigner {
10                 match self {
11                         ChannelSignerType::Ecdsa(ecs) => ecs
12                 }
13         }
14
15         pub(crate) fn as_mut(&mut self) -> &mut dyn ChannelSigner {
16                 match self {
17                         ChannelSignerType::Ecdsa(ecs) => ecs
18                 }
19         }
20
21         #[allow(unused)]
22         pub(crate) fn as_ecdsa(&self) -> Option<&ECS> {
23                 match self {
24                         ChannelSignerType::Ecdsa(ecs) => Some(ecs)
25                 }
26         }
27
28         #[allow(unused)]
29         pub(crate) fn as_mut_ecdsa(&mut self) -> Option<&mut ECS> {
30                 match self {
31                         ChannelSignerType::Ecdsa(ecs) => Some(ecs)
32                 }
33         }
34 }