Fix program buffer account rent-exempt lamport calculation (#34722)

fix program buffer size in minimul for rent exempt calculation

Co-authored-by: HaoranYi <haoran.yi@solana.com>
This commit is contained in:
HaoranYi 2024-01-10 11:32:51 -06:00 committed by GitHub
parent e3df207963
commit 61e42cb390
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -116,6 +116,7 @@ pub fn load_upgradeable_buffer<T: Client>(
let program = load_program_from_file(name);
let buffer_pubkey = buffer_keypair.pubkey();
let buffer_authority_pubkey = buffer_authority_keypair.pubkey();
let program_buffer_bytes = UpgradeableLoaderState::size_of_programdata(program.len());
bank_client
.send_and_confirm_message(
@ -127,7 +128,7 @@ pub fn load_upgradeable_buffer<T: Client>(
&buffer_authority_pubkey,
1.max(
bank_client
.get_minimum_balance_for_rent_exemption(program.len())
.get_minimum_balance_for_rent_exemption(program_buffer_bytes)
.unwrap(),
),
program.len(),