Skip to content

Commit

Permalink
rename function
Browse files Browse the repository at this point in the history
  • Loading branch information
JesseAbram committed Aug 13, 2024
1 parent 94249f6 commit 49c4b4a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions crates/threshold-signature-server/src/validator/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,12 @@ pub async fn new_reshare(
)
.map_err(|e| ValidatorErr::VerifyingKeyError(e.to_string()))?;

let is_proper_signer =
is_proper_signer(signer.account_id(), validators_info.clone(), &app_state.kv_store).await?;
let is_proper_signer = is_signer_or_delete_parent_key(
signer.account_id(),
validators_info.clone(),
&app_state.kv_store,
)
.await?;

if !is_proper_signer {
return Ok(StatusCode::MISDIRECTED_REQUEST);
Expand Down Expand Up @@ -361,7 +365,7 @@ pub async fn prune_old_holders(
}

/// Checks if TSS is a proper signer and if isn't deletes their parent key if they have one
pub async fn is_proper_signer(
pub async fn is_signer_or_delete_parent_key(
account_id: &AccountId32,
validators_info: Vec<ValidatorInfo>,
kv_manager: &KvManager,
Expand Down
2 changes: 1 addition & 1 deletion crates/threshold-signature-server/src/validator/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ async fn test_deletes_key() {
kv.kv().put(reservation, vec![10]).await.unwrap();

let is_proper_signer_result =
is_proper_signer(&dave.to_account_id().into(), vec![], &kv).await.unwrap();
is_signer_or_delete_parent_key(&dave.to_account_id().into(), vec![], &kv).await.unwrap();
assert!(!is_proper_signer_result);

let has_key = kv.kv().exists(&hex::encode(NETWORK_PARENT_KEY)).await.unwrap();
Expand Down

0 comments on commit 49c4b4a

Please sign in to comment.