MCPcopy Create free account
hub / github.com/docknetwork/crypto / receive_commitment

Method receive_commitment

oblivious_transfer/src/cointoss.rs:69–87  ·  view source on GitHub ↗

Process received commitments to the shares from another party and store it

(
        &mut self,
        sender_id: ParticipantId,
        commitments: Commitments,
    )

Source from the content-addressed store, hash-verified

67
68 /// Process received commitments to the shares from another party and store it
69 pub fn receive_commitment(
70 &mut self,
71 sender_id: ParticipantId,
72 commitments: Commitments,
73 ) -> Result<(), OTError> {
74 if self.id == sender_id {
75 return Err(OTError::SenderIdCannotBeSameAsSelf(sender_id, self.id));
76 }
77 if self.other_commitments.contains_key(&sender_id) {
78 return Err(OTError::AlreadyHaveCommitmentFromParticipant(sender_id));
79 }
80 expect_equality!(
81 self.own_shares_and_salts.len(),
82 commitments.0.len(),
83 OTError::IncorrectNoOfCommitments
84 );
85 self.other_commitments.insert(sender_id, commitments);
86 Ok(())
87 }
88
89 /// Process a received share from another party, verify it against the commitment receiver earlier
90 /// and store the shares

Callers 2

do_phase1Function · 0.45
checkFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected