Skip to content

Commit acd931a

Browse files
committed
apply_compute_budget correctly for sweep command
1 parent f0ee0c1 commit acd931a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ async fn retry_get_historical_price(
152152
token.get_historical_price(rpc_client, block_date).await
153153
}
154154

155-
#[derive(Default, Debug)]
155+
#[derive(Default, Debug, Clone, Copy)]
156156
struct ComputeBudget {
157157
compute_unit_price_micro_lamports: Option<u64>,
158158
compute_unit_limit: Option<u32>,
@@ -3176,6 +3176,8 @@ async fn process_account_sweep<T: Signers>(
31763176

31773177
let (signature, maybe_transaction) = match existing_signature {
31783178
None => {
3179+
apply_compute_budget(rpc_client, &mut instructions, compute_budget);
3180+
31793181
let mut message = Message::new(&instructions, Some(&from_authority_address));
31803182
message.recent_blockhash = recent_blockhash;
31813183

@@ -3193,8 +3195,6 @@ async fn process_account_sweep<T: Signers>(
31933195
println!("TODO: account for priority fee in lot split...");
31943196
}
31953197

3196-
apply_compute_budget(rpc_client, &mut instructions, compute_budget);
3197-
31983198
let mut transaction = Transaction::new_unsigned(message);
31993199
let simulation_result = rpc_client.simulate_transaction(&transaction)?.value;
32003200
if simulation_result.err.is_some() {

0 commit comments

Comments
 (0)