Skip to content

Commit

Permalink
Fix CLI get bank
Browse files Browse the repository at this point in the history
  • Loading branch information
jgur-psyops committed Dec 19, 2024
1 parent f8ca780 commit 99a03f9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions clients/rust/marginfi-cli/src/processor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ use {
signature::Keypair,
signer::Signer,
system_program,
sysvar::{self, Sysvar},
sysvar::{self},
transaction::Transaction,
},
spl_associated_token_account::{
Expand Down Expand Up @@ -1166,7 +1166,11 @@ pub fn bank_get(config: Config, bank_pk: Option<Pubkey>) -> Result<()> {
let mut bank: Bank = config.mfi_program.account(address)?;
let group: MarginfiGroup = config.mfi_program.account(bank.group)?;

bank.accrue_interest(Clock::get()?.unix_timestamp, &group)?;
let current_timestamp = SystemTime::now()
.duration_since(UNIX_EPOCH)
.expect("Time went backwards");

bank.accrue_interest(current_timestamp.as_secs() as i64, &group)?;

print_bank(&address, &bank);

Expand Down
1 change: 1 addition & 0 deletions programs/marginfi/src/state/marginfi_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,7 @@ impl Bank {
solana_program::log::sol_log_compute_units();

let time_delta: u64 = (current_timestamp - self.last_update).try_into().unwrap();
print!(" Cranking accrue interest. Time since last update: {:?}", time_delta);

if time_delta == 0 {
return Ok(());
Expand Down

0 comments on commit 99a03f9

Please sign in to comment.