Skip to content

Commit

Permalink
fixed lock, works with tmp_storage_pda, adapted test accordingly
Browse files Browse the repository at this point in the history
  • Loading branch information
ananas-block committed Mar 10, 2022
1 parent 6ea5d46 commit 870c07c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions program/src/poseidon_merkle_tree/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ impl<'a, 'b> MerkleTreeProcessor<'a, 'b> {
self.program_id,
)?;
pubkey_check(
*signer.key,
*_tmp_storage_pda.key,
solana_program::pubkey::Pubkey::new(&merkle_tree_pda_data.pubkey_locked),
String::from("Merkle tree locked by another account."),
)?;
Expand Down Expand Up @@ -156,7 +156,7 @@ impl<'a, 'b> MerkleTreeProcessor<'a, 'b> {
|| merkle_tree_pda_data.time_locked + LOCK_DURATION < current_slot
{
merkle_tree_pda_data.time_locked = <Clock as Sysvar>::get()?.slot;
merkle_tree_pda_data.pubkey_locked = signer.key.to_bytes().to_vec();
merkle_tree_pda_data.pubkey_locked = _tmp_storage_pda.key.to_bytes().to_vec();
msg!("Locked at slot: {}", merkle_tree_pda_data.time_locked);
msg!(
"Locked by: {:?}",
Expand Down Expand Up @@ -218,7 +218,7 @@ impl<'a, 'b> MerkleTreeProcessor<'a, 'b> {

//checking if signer locked
pubkey_check(
*signer.key,
*_tmp_storage_pda.key,
solana_program::pubkey::Pubkey::new(&merkle_tree_pda_data.pubkey_locked),
String::from("Merkle tree locked by other account."),
)?;
Expand Down
4 changes: 2 additions & 2 deletions program/tests/onchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ pub async fn update_merkle_tree(
) {
let mut i = 0;
let mut cache_index = 1267;

for instruction_id in 0..236 {
//checking merkle tree lock
if instruction_id != 0 {
Expand All @@ -298,7 +298,7 @@ pub async fn update_merkle_tree(
MerkleTree::unpack(&merkle_tree_pda_account.data.clone()).unwrap();
assert_eq!(
Pubkey::new(&merkle_tree_pda_account_data.pubkey_locked[..]),
signer_keypair.pubkey()
*tmp_storage_pda_pubkey
);
let tmp_storage_pda_account = program_context
.banks_client
Expand Down

0 comments on commit 870c07c

Please sign in to comment.