From 716dacf7f8c775ec726592580d06cb7b89507509 Mon Sep 17 00:00:00 2001 From: Nhan Phan Date: Mon, 4 Mar 2024 19:41:17 -0800 Subject: [PATCH] fix test, correctly burn --- clients/js/test/plugins/asset/burn.test.ts | 2 +- programs/mpl-core/src/utils.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/clients/js/test/plugins/asset/burn.test.ts b/clients/js/test/plugins/asset/burn.test.ts index 90d13df2..49641e54 100644 --- a/clients/js/test/plugins/asset/burn.test.ts +++ b/clients/js/test/plugins/asset/burn.test.ts @@ -50,7 +50,7 @@ test('it can burn an asset as the owner', async (t) => { const afterAsset = await umi.rpc.getAccount(assetAddress.publicKey); t.true(afterAsset.exists); assertAccountExists(afterAsset); - t.deepEqual(afterAsset.lamports, sol(0.00089784)); + t.deepEqual(afterAsset.lamports, sol(0.00089784 + 0.0015)); t.is(afterAsset.data.length, 1); t.is(afterAsset.data[0], Key.Uninitialized); }); diff --git a/programs/mpl-core/src/utils.rs b/programs/mpl-core/src/utils.rs index 427beb05..b4ece5ec 100644 --- a/programs/mpl-core/src/utils.rs +++ b/programs/mpl-core/src/utils.rs @@ -163,7 +163,7 @@ pub(crate) fn close_program_account<'a>( **funds_dest_account_info.lamports.borrow_mut() = dest_starting_lamports .checked_add(amount_to_return) .ok_or(MplCoreError::NumericalOverflowError)?; - **account_to_close_info.lamports.borrow_mut() = one_byte_rent; + **account_to_close_info.try_borrow_mut_lamports()? -= amount_to_return; account_to_close_info.realloc(1, false)?; account_to_close_info.data.borrow_mut()[0] = Key::Uninitialized.to_u8().unwrap();