Tidy TransactionError

This commit is contained in:
Deirdre Connolly 2020-10-28 20:22:25 -04:00 committed by Deirdre Connolly
parent b2df84fc59
commit 8cac287aa2
3 changed files with 4 additions and 5 deletions

View File

@ -43,13 +43,13 @@ pub enum TransactionError {
#[error("if there are no Spends or Outputs, the value balance MUST be 0.")] #[error("if there are no Spends or Outputs, the value balance MUST be 0.")]
BadBalance, BadBalance,
/// Could not verify a transparent script #[error("could not verify a transparent script")]
Script(#[from] zebra_script::Error), Script(#[from] zebra_script::Error),
// XXX change this when we align groth16 verifier errors with bellman // XXX change this when we align groth16 verifier errors with bellman
// and add a from annotation when the error type is more precise // and add a from annotation when the error type is more precise
#[error("spend proof MUST be valid given a primary input formed from the other fields except spendAuthSig")] #[error("spend proof MUST be valid given a primary input formed from the other fields except spendAuthSig")]
Groth16(BoxError), Groth16,
#[error( #[error(
"joinSplitSig MUST represent a valid signature under joinSplitPubKey of dataToBeSigned" "joinSplitSig MUST represent a valid signature under joinSplitPubKey of dataToBeSigned"
@ -64,7 +64,7 @@ impl From<BoxError> for TransactionError {
fn from(err: BoxError) -> Self { fn from(err: BoxError) -> Self {
match err.downcast::<redjubjub::Error>() { match err.downcast::<redjubjub::Error>() {
Ok(e) => TransactionError::RedJubjub(*e), Ok(e) => TransactionError::RedJubjub(*e),
Err(e) => TransactionError::Internal(e), Err(e) => panic!(e),
} }
} }
} }

View File

@ -5,7 +5,6 @@ use std::{
task::{Context, Poll}, task::{Context, Poll},
}; };
use displaydoc::Display;
use futures::{ use futures::{
stream::{FuturesUnordered, StreamExt}, stream::{FuturesUnordered, StreamExt},
FutureExt, FutureExt,

View File

@ -19,7 +19,7 @@ use zebra_chain::{
transparent, transparent,
}; };
#[derive(Debug, Display, Error)] #[derive(Debug, Display, Error, PartialEq)]
#[non_exhaustive] #[non_exhaustive]
/// An Error type representing the error codes returned from zcash_script. /// An Error type representing the error codes returned from zcash_script.
pub enum Error { pub enum Error {