fn sanity_check(balance_book: &BalanceBook) -> Result<(), String> {
        let mut sum_icpt = Tokens::ZERO;
        for acc in balance_book.store.acc_to_hist.keys() {
            sum_icpt += balance_book.account_balance(acc);
        }
        let expected_icpt_pool = (Tokens::MAX - sum_icpt).unwrap();
        if expected_icpt_pool != balance_book.token_pool {
            return Err(format!(
                "Incorrect ICPT pool value in the snapshot (expected: {}, got: {})",
                expected_icpt_pool, balance_book.token_pool
            ));
        }
        Ok(())
    }
/// Sanity check (sum of tokens equal pool size).
Sanity check (sum of tokens equal pool size).
Sanity check ( sum of tokens equal pool size ) .
fn sanity_check(balance_book: &BalanceBook) -> Result<(), String> {
        let mut sum_icpt = Tokens::ZERO;
        for acc in balance_book.store.acc_to_hist.keys() {
            sum_icpt += balance_book.account_balance(acc);
        }
        let expected_icpt_pool = (Tokens::MAX - sum_icpt).unwrap();
        if expected_icpt_pool != balance_book.token_pool {
            return Err(format!(
                "Incorrect ICPT pool value in the snapshot (expected: {}, got: {})",
                expected_icpt_pool, balance_book.token_pool
            ));
        }
        Ok(())
    }
fn sanity_check ( balance_book : & BalanceBook ) -> Result < ( ) , String > { let mut sum_icpt = Tokens :: ZERO ; for acc in balance_book . store . acc_to_hist . keys ( ) { sum_icpt += balance_book . account_balance ( acc ) ; } let expected_icpt_pool = ( Tokens :: MAX - sum_icpt ) . unwrap ( ) ; if expected_icpt_pool != balance_book . token_pool { return Err ( format ! ( " " expected_icpt_pool balance_book token_pool ) ) ; } Ok ( ( ) ) }
Sanity check (sum of tokens equal pool size).
Sanity check ( sum of tokens equal pool size ) .
balance_book
&BalanceBook
balance_book
&BalanceBook