From 4ab7d0d5a7783e3b1c5153b72b51aa6b6820d55c Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Sat, 30 Mar 2024 14:01:23 +0100 Subject: [PATCH] mpc: add MerkleBlock::conceal_other method Closes #162 --- commit_verify/src/mpc/block.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/commit_verify/src/mpc/block.rs b/commit_verify/src/mpc/block.rs index 5acb27c0..d8470309 100644 --- a/commit_verify/src/mpc/block.rs +++ b/commit_verify/src/mpc/block.rs @@ -258,6 +258,19 @@ impl MerkleBlock { }) } + /// Conceals all commitments in the block except for the commitment under + /// given `protocol_id`. Also removes information about the entropy value + /// used. + /// + /// # Error + /// + /// If leaf with the given `protocol_id` is not found (absent or already + /// concealed), errors with [`LeafNotKnown`] error. + pub fn conceal_other(&mut self, protocol: ProtocolId) -> Result<(), LeafNotKnown> { + self.conceal_except([protocol])?; + Ok(()) + } + /// Conceals all commitments in the block except for the commitment under /// given `protocol_id`s. Also removes information about the entropy value /// used. @@ -516,7 +529,7 @@ Changed commitment id: {}", mut self, protocol_id: ProtocolId, ) -> Result { - self.conceal_except([protocol_id])?; + self.conceal_other(protocol_id)?; let mut map = BTreeMap::::new(); for node in &self.cross_section { match node {