Skip to content

Commit ac23fa3

Browse files
committed
Change get_balance to return in categories.
Add type balance with add, display traits. Change affected tests. Update `CHANGELOG.md`
1 parent ab2397a commit ac23fa3

File tree

6 files changed

+207
-69
lines changed

6 files changed

+207
-69
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
## [Unreleased]
88
- New MSRV set to `1.56.1`
99
- Fee sniping discouraging through nLockTime - if the user specifies a `current_height`, we use that as a nlocktime, otherwise we use the last sync height (or 0 if we never synced)
10+
- Return balance in separate categories, namely `available`, `trusted_pending`, `untrusted_pending` & `immature`.
1011

1112
## [v0.19.0] - [v0.18.0]
1213

src/blockchain/electrum.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,6 @@ mod test {
383383
.sync_wallet(&wallet, None, Default::default())
384384
.unwrap();
385385

386-
assert_eq!(wallet.get_balance().unwrap(), 50_000);
386+
assert_eq!(wallet.get_balance().unwrap().untrusted_pending, 50_000);
387387
}
388388
}

src/blockchain/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ This example shows how to sync multiple walles and return the sum of their balan
187187
# use bdk::database::*;
188188
# use bdk::wallet::*;
189189
# use bdk::*;
190-
fn sum_of_balances<B: BlockchainFactory>(blockchain_factory: B, wallets: &[Wallet<MemoryDatabase>]) -> Result<u64, Error> {
190+
fn sum_of_balances<B: BlockchainFactory>(blockchain_factory: B, wallets: &[Wallet<MemoryDatabase>]) -> Result<Balance, Error> {
191191
Ok(wallets
192192
.iter()
193193
.map(|w| -> Result<_, Error> {

0 commit comments

Comments
 (0)