diff --git a/dbc/src/anchor.rs b/dbc/src/anchor.rs index d21580b9..3e71224a 100644 --- a/dbc/src/anchor.rs +++ b/dbc/src/anchor.rs @@ -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, M: DbcMethod> Anchor { @@ -200,6 +203,9 @@ impl, M: DbcMethod> Anchor { /// Merges two anchors keeping revealed data. pub fn merge_reveal(mut self, other: Self) -> Result { + if self.method != other.method { + return Err(MergeError::MethodMismatch); + } if self.dbc_proof != other.dbc_proof { return Err(MergeError::DbcMismatch); }