Function zcash_client_sqlite::wallet::get_balance_at[][src]

pub fn get_balance_at<P>(
    wdb: &WalletDb<P>,
    account: AccountId,
    anchor_height: BlockHeight
) -> Result<Amount, SqliteClientError>
Expand description

Returns the verified balance for the account at the specified height, This may be used to obtain a balance that ignores notes that have been received so recently that they are not yet deemed spendable.

Examples

use tempfile::NamedTempFile;
use zcash_primitives::consensus::{BlockHeight, Network};
use zcash_client_backend::wallet::AccountId;
use zcash_client_sqlite::{
    WalletDb,
    wallet::get_balance_at,
};

let data_file = NamedTempFile::new().unwrap();
let db = WalletDb::for_path(data_file, Network::TestNetwork).unwrap();
let addr = get_balance_at(&db, AccountId(0), BlockHeight::from_u32(0));