Skip to content

Commit

Permalink
Merge pull request #164 from LNP-BP/fix/162
Browse files Browse the repository at this point in the history
Add MerkleBlock::conceal_other method
  • Loading branch information
dr-orlovsky authored Apr 18, 2024
2 parents 3425446 + 4ab7d0d commit eadb830
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion commit_verify/src/mpc/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -516,7 +529,7 @@ Changed commitment id: {}",
mut self,
protocol_id: ProtocolId,
) -> Result<MerkleProof, LeafNotKnown> {
self.conceal_except([protocol_id])?;
self.conceal_other(protocol_id)?;
let mut map = BTreeMap::<u5, MerkleHash>::new();
for node in &self.cross_section {
match node {
Expand Down

0 comments on commit eadb830

Please sign in to comment.