Skip to content

Commit

Permalink
Handle mining_device open channel error case
Browse files Browse the repository at this point in the history
.. just return the error to the user to give an indication that an
error occurd.
  • Loading branch information
jbesraa committed Sep 16, 2024
1 parent e23fbe6 commit b49416c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions protocols/v2/roles-logic-sv2/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ pub enum Error {
HashrateError(InputError),
LogicErrorMessage(std::boxed::Box<AllMessages<'static>>),
JDSMissingTransactions,
MiningChannelError(u32),
}

impl From<BinarySv2Error> for Error {
Expand Down Expand Up @@ -153,6 +154,7 @@ impl Display for Error {
HashrateError(e) => write!(f, "Impossible to get Hashrate: {:?}", e),
LogicErrorMessage(e) => write!(f, "Message is well formatted but can not be handled: {:?}", e),
JDSMissingTransactions => write!(f, "JD server cannot propagate the block: missing transactions"),
MiningChannelError(e) => write!(f, "Mining channel error: {:?}", e),
}
}
}
4 changes: 2 additions & 2 deletions roles/test-utils/mining-device/src/lib/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,9 @@ impl ParseUpstreamMiningMessages<(), NullDownstreamMiningSelector, NoRouting> fo

fn handle_open_mining_channel_error(
&mut self,
_: OpenMiningChannelError,
e: OpenMiningChannelError,
) -> Result<SendTo<()>, Error> {
todo!()
return Err(Error::MiningChannelError(e.request_id));
}

fn handle_update_channel_error(&mut self, _: UpdateChannelError) -> Result<SendTo<()>, Error> {
Expand Down

0 comments on commit b49416c

Please sign in to comment.