Skip to content

Commit 88126d2

Browse files
authored
Merge pull request stratum-mining#74 from Shourya742/2025-11-06-remove-unwanted-error-variants
Remove unwanted error variants in JDC
2 parents a24e5c1 + 2b0ca5d commit 88126d2

1 file changed

Lines changed: 24 additions & 24 deletions

File tree

miner-apps/jd-client/src/lib/error.rs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ pub enum ChannelSv2Error {
4545

4646
#[derive(Debug)]
4747
pub enum JDCError {
48-
#[allow(dead_code)]
49-
VecToSlice32(Vec<u8>),
5048
/// Errors on bad CLI argument input.
5149
BadCliArgs,
5250
/// Errors on bad `config` TOML deserialize.
@@ -61,45 +59,62 @@ pub enum JDCError {
6159
Io(std::io::Error),
6260
/// Errors on bad `String` to `int` conversion.
6361
ParseInt(std::num::ParseIntError),
64-
#[allow(dead_code)]
65-
SubprotocolMining(String),
66-
// Locking Errors
67-
PoisonLock,
68-
TokioChannelErrorRecv(tokio::sync::broadcast::error::RecvError),
69-
Infallible(std::convert::Infallible),
7062
Parser(ParserError),
7163
/// Channel receiver error
7264
ChannelErrorReceiver(async_channel::RecvError),
7365
/// Channel sender error
7466
ChannelErrorSender,
7567
/// Broadcast channel receiver error
7668
BroadcastChannelErrorReceiver(broadcast::error::RecvError),
69+
/// Shutdown
7770
Shutdown,
71+
/// Network helpers error
7872
NetworkHelpersError(network_helpers::Error),
73+
/// Unexpected message
7974
UnexpectedMessage(u8),
75+
/// Invalid user identity
8076
InvalidUserIdentity(String),
77+
/// Bitcoin encode error
8178
BitcoinEncodeError(bitcoin::consensus::encode::Error),
79+
/// Invalid socket address
8280
InvalidSocketAddress(String),
81+
/// Timeout error
8382
Timeout,
83+
/// Declared job corresponding to request Id not found.
8484
LastDeclareJobNotFound(RequestId),
85+
/// No active job with job id
8586
ActiveJobNotFound(JobId),
87+
/// No active token
8688
TokenNotFound,
89+
/// Template not found with template ID
8790
TemplateNotFound(TemplateId),
91+
/// Downstream not found with downstream ID
8892
DownstreamNotFound(DownstreamId),
89-
DownstreamIdNotFound,
93+
/// Future template not present
9094
FutureTemplateNotPresent,
95+
/// Last new prevhash not found
9196
LastNewPrevhashNotFound,
97+
/// Vardiff not found
9298
VardiffNotFound(VardiffKey),
99+
/// Tx data error
93100
TxDataError,
101+
/// Frame conversion error
94102
FrameConversionError,
103+
/// Failed to create custom Job
95104
FailedToCreateCustomJob,
105+
/// Allocate Mining job token coinbase output error
96106
AllocateMiningJobTokenSuccessCoinbaseOutputsError,
107+
/// Channel manager has bad coinbase outputs.
97108
ChannelManagerHasBadCoinbaseOutputs,
109+
/// Declared job has bad coinbase outputs.
98110
DeclaredJobHasBadCoinbaseOutputs,
111+
/// Extranonce size is too large
99112
ExtranonceSizeTooLarge,
113+
/// Could not create group channel
100114
FailedToCreateGroupChannel(GroupChannelError),
101115
///Channel Errors
102116
ChannelSv2(ChannelSv2Error),
117+
/// Extranonce prefix error
103118
ExtranoncePrefixFactoryError(ExtendedExtranonceError),
104119
}
105120

@@ -116,12 +131,7 @@ impl fmt::Display for JDCError {
116131
FramingSv2(ref e) => write!(f, "Framing SV2 error: `{e:?}`"),
117132
Io(ref e) => write!(f, "I/O error: `{e:?}"),
118133
ParseInt(ref e) => write!(f, "Bad convert from `String` to `int`: `{e:?}`"),
119-
SubprotocolMining(ref e) => write!(f, "Subprotocol Mining Error: `{e:?}`"),
120-
PoisonLock => write!(f, "Poison Lock error"),
121134
ChannelErrorReceiver(ref e) => write!(f, "Channel receive error: `{e:?}`"),
122-
TokioChannelErrorRecv(ref e) => write!(f, "Channel receive error: `{e:?}`"),
123-
VecToSlice32(ref e) => write!(f, "Standard Error: `{e:?}`"),
124-
Infallible(ref e) => write!(f, "Infallible Error:`{e:?}`"),
125135
Parser(ref e) => write!(f, "Parser error: `{e:?}`"),
126136
BroadcastChannelErrorReceiver(ref e) => {
127137
write!(f, "Broadcast channel receive error: {e:?}")
@@ -152,9 +162,6 @@ impl fmt::Display for JDCError {
152162
"Downstream not found with downstream_id: {downstream_id}"
153163
)
154164
}
155-
DownstreamIdNotFound => {
156-
write!(f, "Downstream id not found")
157-
}
158165
FutureTemplateNotPresent => {
159166
write!(f, "Future template not present")
160167
}
@@ -212,7 +219,6 @@ impl JDCError {
212219
| JDCError::TokenNotFound
213220
| JDCError::TemplateNotFound(_)
214221
| JDCError::DownstreamNotFound(_)
215-
| JDCError::DownstreamIdNotFound
216222
| JDCError::VardiffNotFound(_)
217223
| JDCError::TxDataError
218224
| JDCError::FrameConversionError
@@ -280,12 +286,6 @@ impl From<async_channel::RecvError> for JDCError {
280286
}
281287
}
282288

283-
impl From<tokio::sync::broadcast::error::RecvError> for JDCError {
284-
fn from(e: tokio::sync::broadcast::error::RecvError) -> Self {
285-
JDCError::TokioChannelErrorRecv(e)
286-
}
287-
}
288-
289289
impl From<network_helpers::Error> for JDCError {
290290
fn from(value: network_helpers::Error) -> Self {
291291
JDCError::NetworkHelpersError(value)

0 commit comments

Comments
 (0)