use std::convert::TryFrom;
use std::fmt::{Debug, Display};
use std::hash::Hash;
use strict_encoding;
use super::channel;
use crate::Messages;
pub trait Nomenclature
where
Self: Clone
+ Copy
+ PartialEq
+ Eq
+ PartialOrd
+ Ord
+ Hash
+ Debug
+ Display
+ Default
+ TryFrom<u16, Error = strict_encoding::Error>
+ Into<u16>,
{
}
pub trait Extension {
type Identity: Nomenclature;
fn identity(&self) -> Self::Identity;
fn update_from_peer(
&mut self,
data: &Messages,
) -> Result<(), channel::Error>;
fn extension_state(&self) -> Box<dyn channel::State>;
}
pub trait RoutingExtension: Extension {}
pub trait GossipExtension: Extension {}
pub trait ChannelExtension: Extension {
fn channel_state(&self) -> Box<dyn channel::State>;
fn apply(
&mut self,
tx_graph: &mut channel::TxGraph,
) -> Result<(), channel::Error>;
}