Skip to content

Commit

Permalink
Merge pull request #787 from Fi3/AddCloneForSv1Methods
Browse files Browse the repository at this point in the history
Add clone to the sv1 public types
  • Loading branch information
Fi3 committed Mar 19, 2024
2 parents f383fd1 + e4f25df commit 95d89b2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions protocols/v1/src/methods/client_to_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ fn from_to_json_rpc(auth: Authorize) -> bool {
/// _mining.extranonce.subscribe()_
/// Indicates to the server that the client supports the mining.set_extranonce method.
/// https://en.bitcoin.it/wiki/BIP_0310
#[derive(Debug)]
#[derive(Debug, Clone, Copy)]
pub struct ExtranonceSubscribe();

// mining.get_transactions
Expand Down Expand Up @@ -339,7 +339,7 @@ impl<'a> TryFrom<StandardRequest> for Subscribe<'a> {
}
}

#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct Configure {
extensions: Vec<ConfigureExtension>,
id: u64,
Expand Down Expand Up @@ -432,7 +432,7 @@ impl TryFrom<StandardRequest> for Configure {
}
}

#[derive(Debug)]
#[derive(Debug, Clone)]
pub enum ConfigureExtension {
VersionRolling(VersionRollingParams),
MinimumDifficulty(u64),
Expand Down Expand Up @@ -599,7 +599,7 @@ impl From<ConfigureExtension> for serde_json::Map<String, Value> {
}
}

#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct VersionRollingParams {
mask: Option<HexU32Be>,
min_bit_count: Option<HexU32Be>,
Expand Down Expand Up @@ -629,7 +629,7 @@ impl From<VersionRollingParams> for serde_json::Map<String, Value> {
}
}

#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct InfoParams {
connection_url: Option<String>,
#[allow(dead_code)]
Expand Down
12 changes: 6 additions & 6 deletions protocols/v1/src/methods/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub mod server_to_client;
use crate::json_rpc::{Message, Response};

/// Errors encountered during conversion between valid json_rpc messages and Sv1 messages.
#[derive(Debug)]
#[derive(Debug, Clone)]
pub enum MethodError<'a> {
/// If the json_rpc message call a method not defined by Sv1. It contains the called method
MethodNotFound(String),
Expand Down Expand Up @@ -48,7 +48,7 @@ impl From<binary_sv2::Error> for ParsingMethodError {
}
}

#[derive(Debug)]
#[derive(Debug, Clone)]
pub enum ParsingMethodError {
BadU256Convert(Box<binary_sv2::Error>),
HexError(Box<FromHexError>),
Expand Down Expand Up @@ -115,15 +115,15 @@ impl ParsingMethodError {
}
}

#[derive(Debug)]
#[derive(Debug, Clone)]
pub enum Method<'a> {
Client2Server(Client2Server<'a>),
Server2Client(Server2Client<'a>),
Server2ClientResponse(Server2ClientResponse<'a>),
ErrorMessage(Message),
}

#[derive(Debug)]
#[derive(Debug, Clone)]
pub enum Client2Server<'a> {
SuggestDifficulty(),
Subscribe(client_to_server::Subscribe<'a>),
Expand Down Expand Up @@ -153,7 +153,7 @@ impl<'a> TryFrom<Message> for Client2Server<'a> {
}
}

#[derive(Debug)]
#[derive(Debug, Clone)]
pub enum Server2Client<'a> {
Notify(server_to_client::Notify<'a>),
SetDifficulty(server_to_client::SetDifficulty),
Expand Down Expand Up @@ -181,7 +181,7 @@ impl<'a> TryFrom<Message> for Server2Client<'a> {
}
}

#[derive(Debug)]
#[derive(Debug, Clone)]
pub enum Server2ClientResponse<'a> {
Configure(server_to_client::Configure),
Subscribe(server_to_client::Subscribe<'a>),
Expand Down
6 changes: 3 additions & 3 deletions protocols/v1/src/methods/server_to_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ impl<'a> TryFrom<Notification> for SetExtranonce<'a> {
}
}

#[derive(Debug)]
#[derive(Debug, Clone)]
/// Server may arbitrarily adjust version mask
pub struct SetVersionMask {
version_mask: HexU32Be,
Expand Down Expand Up @@ -423,7 +423,7 @@ impl<'a> TryFrom<&Response> for Subscribe<'a> {
}
}

#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct Configure {
pub id: u64,
pub version_rolling: Option<VersionRollingParams>,
Expand Down Expand Up @@ -548,7 +548,7 @@ impl TryFrom<&Response> for Configure {
}
}

#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct VersionRollingParams {
pub version_rolling: bool,
pub version_rolling_mask: HexU32Be,
Expand Down
2 changes: 1 addition & 1 deletion protocols/v2/binary-sv2/no-serde-sv2/codec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pub mod encodable {
#[macro_use]
extern crate alloc;

#[derive(Debug, PartialEq, Eq)]
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum Error {
OutOfBound,
NotABool(u8),
Expand Down

0 comments on commit 95d89b2

Please sign in to comment.