// In here, ledger removes zero amount accounts from it's map,
// but we can't do that or we may risk giving incorrect
// historical balance information
In here, ledger removes zero amount accounts from it's map,
but we can't do that or we may risk giving incorrect
historical balance information
In here ledger removes zero amount accounts from it ' s map but we can ' t do that or we may risk giving incorrect historical balance information
fn update<F, E>(&mut self, k: AccountIdentifier, mut f: F) -> Result<Tokens, E>
    where
        F: FnMut(Option<&Tokens>) -> Result<Tokens, E>,
    {
        let index = self
            .transaction_context
            .expect("Transaction context missing");
        let acc_hist = self.acc_to_hist.entry(k).or_default();
        let last_balance = acc_hist.get_last_ref();
        let new_balance = f(last_balance)?;
        acc_hist.insert(index, new_balance);
        Ok(new_balance)
    }
fn update < F , E > ( & mut self , k : AccountIdentifier , mut f : F ) -> Result < Tokens , E > where F : FnMut ( Option < & Tokens > ) -> Result < Tokens , E > , { let index = self . transaction_context . expect ( " " ) ; let acc_hist = self . acc_to_hist . entry ( k ) . or_default ( ) ; let last_balance = acc_hist . get_last_ref ( ) ; let new_balance = f ( last_balance ) ? ; acc_hist . insert ( index , new_balance ) ; Ok ( new_balance ) }
In here, ledger removes zero amount accounts from it's map,
but we can't do that or we may risk giving incorrect
historical balance information
In here ledger removes zero amount accounts from it ' s map but we can ' t do that or we may risk giving incorrect historical balance information
&mut self
k
AccountIdentifier
f
F