Program mutable lamports (#4964)

This commit is contained in:
Jack May
2019-07-08 15:52:25 -08:00
committed by GitHub
parent 281deae102
commit 841e5e326c
8 changed files with 58 additions and 3 deletions

View File

@ -15,7 +15,7 @@ pub struct SolKeyedAccount<'a> {
/// Public key of the account
pub is_signer: bool,
/// Number of lamports owned by this account
pub lamports: u64,
pub lamports: &'a mut u64,
/// On-chain data within this account
pub data: &'a mut [u8],
/// Program that owns this account
@ -79,7 +79,7 @@ pub unsafe fn deserialize<'a>(
offset += size_of::<SolPubkey>();
#[allow(clippy::cast_ptr_alignment)]
let lamports = *(input.add(offset) as *const u64);
let lamports = &mut *(input.add(offset) as *mut u64);
offset += size_of::<u64>();
#[allow(clippy::cast_ptr_alignment)]

View File

@ -82,7 +82,7 @@ pub fn sol_log_params(ka: &[SolKeyedAccount], data: &[u8]) {
sol_log("- Key");
sol_log_key(&k.key);
sol_log("- Lamports");
sol_log_64(0, 0, 0, 0, k.lamports);
sol_log_64(0, 0, 0, 0, *k.lamports);
sol_log("- AccountData");
sol_log_slice(k.data);
sol_log("- Owner");