Skip to content

Commit

Permalink
Merge branch 'fix/anchors' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Apr 22, 2024
2 parents ff27556 + 9117007 commit 91e195d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion dbc/src/anchor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,11 @@ pub enum MergeError {
#[from]
MpcMismatch(mpc::MergeError),

/// anchors can't be merged since they have different DBC proofs
/// anchors can't be merged since they have different DBC proofs.
DbcMismatch,

/// anchors can't be merged since they use different method.
MethodMismatch,
}

impl<D: dbc::Proof<M>, M: DbcMethod> Anchor<mpc::MerkleProof, D, M> {
Expand Down Expand Up @@ -200,6 +203,9 @@ impl<D: dbc::Proof<M>, M: DbcMethod> Anchor<mpc::MerkleBlock, D, M> {

/// Merges two anchors keeping revealed data.
pub fn merge_reveal(mut self, other: Self) -> Result<Self, MergeError> {
if self.method != other.method {
return Err(MergeError::MethodMismatch);
}
if self.dbc_proof != other.dbc_proof {
return Err(MergeError::DbcMismatch);
}
Expand Down

0 comments on commit 91e195d

Please sign in to comment.