Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 71c1ede

Browse files
authored
test: ensure confidential_transfer using the latest blockhash (#6840)
test: ensure confidential transfer test using the latest blockhash
1 parent 103b86b commit 71c1ede

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

token/program-2022-test/tests/confidential_transfer.rs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1621,11 +1621,12 @@ async fn confidential_transfer_configure_token_account_with_proof_context() {
16211621
instruction_type.encode_verify_proof(Some(context_state_info), &proof_data),
16221622
];
16231623

1624+
let last_blockhash = ctx.get_new_latest_blockhash().await.unwrap();
16241625
let tx = Transaction::new_signed_with_payer(
16251626
&instructions,
16261627
Some(&ctx.payer.pubkey()),
16271628
&[&ctx.payer, &context_state_account],
1628-
ctx.last_blockhash,
1629+
last_blockhash,
16291630
);
16301631
ctx.banks_client.process_transaction(tx).await.unwrap();
16311632
}
@@ -1707,11 +1708,12 @@ async fn confidential_transfer_configure_token_account_with_proof_context() {
17071708
instruction_type.encode_verify_proof(Some(context_state_info), &proof_data),
17081709
];
17091710

1711+
let last_blockhash = ctx.get_new_latest_blockhash().await.unwrap();
17101712
let tx = Transaction::new_signed_with_payer(
17111713
&instructions,
17121714
Some(&ctx.payer.pubkey()),
17131715
&[&ctx.payer, &context_state_account],
1714-
ctx.last_blockhash,
1716+
last_blockhash,
17151717
);
17161718
ctx.banks_client.process_transaction(tx).await.unwrap();
17171719
}
@@ -1793,11 +1795,12 @@ async fn confidential_transfer_empty_account_with_proof_context() {
17931795
instruction_type.encode_verify_proof(Some(context_state_info), &proof_data),
17941796
];
17951797

1798+
let last_blockhash = ctx.get_new_latest_blockhash().await.unwrap();
17961799
let tx = Transaction::new_signed_with_payer(
17971800
&instructions,
17981801
Some(&ctx.payer.pubkey()),
17991802
&[&ctx.payer, &context_state_account],
1800-
ctx.last_blockhash,
1803+
last_blockhash,
18011804
);
18021805
ctx.banks_client.process_transaction(tx).await.unwrap();
18031806
}
@@ -1847,11 +1850,12 @@ async fn confidential_transfer_empty_account_with_proof_context() {
18471850
instruction_type.encode_verify_proof(Some(context_state_info), &proof_data),
18481851
];
18491852

1853+
let last_blockhash = ctx.get_new_latest_blockhash().await.unwrap();
18501854
let tx = Transaction::new_signed_with_payer(
18511855
&instructions,
18521856
Some(&ctx.payer.pubkey()),
18531857
&[&ctx.payer, &context_state_account],
1854-
ctx.last_blockhash,
1858+
last_blockhash,
18551859
);
18561860
ctx.banks_client.process_transaction(tx).await.unwrap();
18571861
}
@@ -1959,11 +1963,12 @@ async fn confidential_transfer_withdraw_with_proof_context() {
19591963
instruction_type.encode_verify_proof(Some(context_state_info), &proof_data),
19601964
];
19611965

1966+
let last_blockhash = ctx.get_new_latest_blockhash().await.unwrap();
19621967
let tx = Transaction::new_signed_with_payer(
19631968
&instructions,
19641969
Some(&ctx.payer.pubkey()),
19651970
&[&ctx.payer, &context_state_account],
1966-
ctx.last_blockhash,
1971+
last_blockhash,
19671972
);
19681973
ctx.banks_client.process_transaction(tx).await.unwrap();
19691974
}
@@ -2016,11 +2021,12 @@ async fn confidential_transfer_withdraw_with_proof_context() {
20162021
instruction_type.encode_verify_proof(Some(context_state_info), &proof_data),
20172022
];
20182023

2024+
let last_blockhash = ctx.get_new_latest_blockhash().await.unwrap();
20192025
let tx = Transaction::new_signed_with_payer(
20202026
&instructions,
20212027
Some(&ctx.payer.pubkey()),
20222028
&[&ctx.payer, &context_state_account],
2023-
ctx.last_blockhash,
2029+
last_blockhash,
20242030
);
20252031
ctx.banks_client.process_transaction(tx).await.unwrap();
20262032
}
@@ -2148,11 +2154,12 @@ async fn confidential_transfer_transfer_with_proof_context() {
21482154
instruction_type.encode_verify_proof(Some(context_state_info), &proof_data),
21492155
];
21502156

2157+
let last_blockhash = ctx.get_new_latest_blockhash().await.unwrap();
21512158
let tx = Transaction::new_signed_with_payer(
21522159
&instructions,
21532160
Some(&ctx.payer.pubkey()),
21542161
&[&ctx.payer, &context_state_account],
2155-
ctx.last_blockhash,
2162+
last_blockhash,
21562163
);
21572164
ctx.banks_client.process_transaction(tx).await.unwrap();
21582165
}
@@ -2219,11 +2226,12 @@ async fn confidential_transfer_transfer_with_proof_context() {
22192226
instruction_type.encode_verify_proof(Some(context_state_info), &proof_data),
22202227
];
22212228

2229+
let last_blockhash = ctx.get_new_latest_blockhash().await.unwrap();
22222230
let tx = Transaction::new_signed_with_payer(
22232231
&instructions,
22242232
Some(&ctx.payer.pubkey()),
22252233
&[&ctx.payer, &context_state_account],
2226-
ctx.last_blockhash,
2234+
last_blockhash,
22272235
);
22282236
ctx.banks_client.process_transaction(tx).await.unwrap();
22292237
}

0 commit comments

Comments
 (0)