Skip to content

Commit

Permalink
Fix identifier for sending round2 (#47)
Browse files Browse the repository at this point in the history
* Use identifiers to send round2 pkgs

* Fix dangling error in test

---------

Co-authored-by: pool2win <[email protected]>
  • Loading branch information
pool2win and pool2win authored Nov 24, 2024
1 parent f55dcf0 commit fa72322
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/node/protocol/dkg/round_two.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,13 @@ impl Package {
);
return Err("Members and round2 packages length mismatch".into());
}

// Collect all the futures into a Vec
let send_futures: Vec<_> = members
.into_iter()
.zip(round2_packages.iter())
.map(|((member_id, reliable_sender), (_, package))| {
.map(|(member_id, reliable_sender)| {
let identifier = frost::Identifier::derive(member_id.as_bytes()).unwrap();
let package = round2_packages.get(&identifier).unwrap();
let message = PackageMessage::new(self.sender_id.clone(), Some(package.clone()));
let message = Message::Unicast(Unicast::DKGRoundTwoPackage(message));
log::debug!("Queueing send to member: {:?}", member_id);
Expand Down Expand Up @@ -336,7 +338,7 @@ mod round_two_tests {
let mut mock = ReliableSenderHandle::default();
mock.expect_clone().returning(ReliableSenderHandle::default);
mock.expect_send()
//.times(1)
// .times(1)
.return_once(|_| futures::future::err("Some error".into()).boxed());
mock
});
Expand Down

0 comments on commit fa72322

Please sign in to comment.