mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-09 20:59:23 +00:00
Remove Protocol::Unsupported
This commit is contained in:
@@ -56,7 +56,6 @@ mod tests;
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, Zeroize)]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub enum Protocol {
|
||||
Unsupported(usize),
|
||||
v14,
|
||||
v16,
|
||||
Custom { ring_len: usize, bp_plus: bool },
|
||||
@@ -66,7 +65,6 @@ impl Protocol {
|
||||
/// Amount of ring members under this protocol version.
|
||||
pub fn ring_len(&self) -> usize {
|
||||
match self {
|
||||
Protocol::Unsupported(_) => panic!("Unsupported protocol version"),
|
||||
Protocol::v14 => 11,
|
||||
Protocol::v16 => 16,
|
||||
Protocol::Custom { ring_len, .. } => *ring_len,
|
||||
@@ -77,7 +75,6 @@ impl Protocol {
|
||||
/// This method will likely be reworked when versions not using Bulletproofs at all are added.
|
||||
pub fn bp_plus(&self) -> bool {
|
||||
match self {
|
||||
Protocol::Unsupported(_) => panic!("Unsupported protocol version"),
|
||||
Protocol::v14 => false,
|
||||
Protocol::v16 => true,
|
||||
Protocol::Custom { bp_plus, .. } => *bp_plus,
|
||||
|
||||
@@ -45,6 +45,8 @@ pub enum RpcError {
|
||||
ConnectionError,
|
||||
#[error("invalid node")]
|
||||
InvalidNode,
|
||||
#[error("unsupported protocol version ({0})")]
|
||||
UnsupportedProtocol(usize),
|
||||
#[error("transactions not found")]
|
||||
TransactionsNotFound(Vec<[u8; 32]>),
|
||||
#[error("invalid point ({0})")]
|
||||
@@ -211,7 +213,7 @@ impl Rpc {
|
||||
{
|
||||
13 | 14 => Protocol::v14,
|
||||
15 | 16 => Protocol::v16,
|
||||
version => Protocol::Unsupported(version),
|
||||
protocol => Err(RpcError::UnsupportedProtocol(protocol))?,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user