Skip to content

Commit

Permalink
Fix compute budget max fees calculation - convert microlamports to la…
Browse files Browse the repository at this point in the history
…mports
  • Loading branch information
0xMMBD committed Sep 17, 2024
1 parent c3306fa commit be50479
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libsol/compute_budget_instruction.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ static uint32_t calculate_max_fee(const ComputeBudgetFeeInfo* info) {
max_compute =
MIN(info->instructions_count * MAX_CU_PER_INSTRUCTION, MAX_CU_PER_TRANSACTION);
}
return max_fee + (info->change_unit_price->units * max_compute);
return max_fee +
((info->change_unit_price->units * max_compute) / MICRO_LAMPORT_MULTIPLIER);
}
return max_fee;
}
Expand Down
1 change: 1 addition & 0 deletions libsol/compute_budget_instruction.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#define MAX_CU_PER_INSTRUCTION 200000
#define MAX_CU_PER_TRANSACTION 1400000
#define FEE_LAMPORTS_PER_SIGNATURE 5000
#define MICRO_LAMPORT_MULTIPLIER 1000000

extern const Pubkey compute_budget_program_id;

Expand Down

0 comments on commit be50479

Please sign in to comment.