Skip to content

Commit

Permalink
feat: add errors NoReissueShares and NoReissueTransaction
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-da committed Sep 7, 2021
1 parent 66fda04 commit f6aa707
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@ impl DbcBuilder {
/// has not been set or no ReissueShare has been added.
pub fn build(self) -> Result<Vec<Dbc>> {
if self.reissue_shares.is_empty() {
return Ok(vec![]);
return Err(Error::NoReissueShares);
}

let reissue_transaction = match self.reissue_transaction {
Some(rt) => rt,
None => return Ok(vec![]),
None => return Err(Error::NoReissueTransaction),
};

let mut mint_sig_shares: Vec<NodeSignature> = Default::default();
Expand Down
6 changes: 6 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ pub enum Error {
#[error("The DbcTransaction in ReissueShare differs from that of ReissueTransaction")]
ReissueShareDbcTransactionMismatch,

#[error("No reissue shares")]
NoReissueShares,

#[error("No reissue transaction")]
NoReissueTransaction,

#[error("RangeProof error: {0}")]
RangeProof(#[from] bulletproofs::ProofError),

Expand Down

0 comments on commit f6aa707

Please sign in to comment.