Skip to content

Commit

Permalink
fmt fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
xoloki committed Nov 22, 2024
1 parent 13cdc84 commit 2cd6dc3
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 38 deletions.
2 changes: 1 addition & 1 deletion signer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ async fn run_transaction_signer(ctx: impl Context) -> Result<(), Error> {

/// Run the transaction coordinator event-loop.
async fn run_transaction_coordinator(ctx: impl Context) -> Result<(), Error> {
let config= ctx.config().clone();
let config = ctx.config().clone();
let private_key = config.signer.private_key;
let network = P2PNetwork::new(&ctx);

Expand Down
3 changes: 1 addition & 2 deletions signer/src/testing/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ impl fake::Dummy<fake::Faker> for message::WstsMessage {
dkg_id: config.fake_with_rng(rng),
signer_ids: config.fake_with_rng(rng),
key_ids: config.fake_with_rng(rng),
dkg_private_shares: Default::default(),
dkg_private_shares: Default::default(),
};

Self {
Expand All @@ -145,4 +145,3 @@ where
{
config.fake_with_rng::<P, _>(rng).into()
}

73 changes: 38 additions & 35 deletions signer/src/transaction_signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,42 +504,42 @@ where
self.relay_message(msg.txid, &msg.inner, bitcoin_chain_tip)
.await?;
}
/*
WstsNetMessage::DkgPublicShares(dkg_public_shares) => {
let public_keys = match self.wsts_state_machines.get(&msg.txid) {
Some(state_machine) => &state_machine.public_keys,
None => return Err(Error::MissingStateMachine),
};
let signer_public_key = match public_keys.signers.get(&dkg_public_shares.signer_id)
{
Some(key) => PublicKey::from(key),
None => return Err(Error::MissingPublicKey),
};
if signer_public_key != msg_public_key {
return Err(Error::InvalidSignature);
/*
WstsNetMessage::DkgPublicShares(dkg_public_shares) => {
let public_keys = match self.wsts_state_machines.get(&msg.txid) {
Some(state_machine) => &state_machine.public_keys,
None => return Err(Error::MissingStateMachine),
};
let signer_public_key = match public_keys.signers.get(&dkg_public_shares.signer_id)
{
Some(key) => PublicKey::from(key),
None => return Err(Error::MissingPublicKey),
};
if signer_public_key != msg_public_key {
return Err(Error::InvalidSignature);
}
self.relay_message(msg.txid, &msg.inner, bitcoin_chain_tip)
.await?;
}
self.relay_message(msg.txid, &msg.inner, bitcoin_chain_tip)
.await?;
}
WstsNetMessage::DkgPrivateShares(dkg_private_shares) => {
let public_keys = match self.wsts_state_machines.get(&msg.txid) {
Some(state_machine) => &state_machine.public_keys,
None => return Err(Error::MissingStateMachine),
};
let signer_public_key = match public_keys.signers.get(&dkg_private_shares.signer_id)
{
Some(key) => PublicKey::from(key),
None => return Err(Error::MissingPublicKey),
};
if signer_public_key != msg_public_key {
return Err(Error::InvalidSignature);
WstsNetMessage::DkgPrivateShares(dkg_private_shares) => {
let public_keys = match self.wsts_state_machines.get(&msg.txid) {
Some(state_machine) => &state_machine.public_keys,
None => return Err(Error::MissingStateMachine),
};
let signer_public_key = match public_keys.signers.get(&dkg_private_shares.signer_id)
{
Some(key) => PublicKey::from(key),
None => return Err(Error::MissingPublicKey),
};
if signer_public_key != msg_public_key {
return Err(Error::InvalidSignature);
}
self.relay_message(msg.txid, &msg.inner, bitcoin_chain_tip)
.await?;
}
self.relay_message(msg.txid, &msg.inner, bitcoin_chain_tip)
.await?;
}
*/
*/
WstsNetMessage::DkgEndBegin(_) => {
if !chain_tip_report.sender_is_coordinator {
tracing::warn!("Got coordinator message from wrong signer");
Expand Down Expand Up @@ -602,7 +602,10 @@ where
tracing::info!("DKG ended in failure: {fail:?}");
// TODO(#414): handle DKG failure
}
WstsNetMessage::DkgPublicShares(_) | WstsNetMessage::DkgPrivateShares(_) | WstsNetMessage::NonceResponse(_) | WstsNetMessage::SignatureShareResponse(_) => {
WstsNetMessage::DkgPublicShares(_)
| WstsNetMessage::DkgPrivateShares(_)
| WstsNetMessage::NonceResponse(_)
| WstsNetMessage::SignatureShareResponse(_) => {
tracing::debug!("ignoring message");
}
}
Expand Down

0 comments on commit 2cd6dc3

Please sign in to comment.