Skip to content

Commit 8d916d7

Browse files
committed
Merge #1285: doc(wallet): improve docs for Wallet::sent_and_received
08b745e doc(wallet): improve docs for `Wallet::sent_and_received` (vmammal) Pull request description: Thank you @thunderbiscuit for raising this issue. I noticed this method borrows the language from `SpkTxOutIndex::sent_and_received`, which this PR doesn't touch. I think in general it's desirable that methods in `bdk_chain` crate would refer to some of the core structures directly. ### Checklists #### All Submissions: * [x] I've signed all my commits * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md) * [x] I ran `cargo fmt` and `cargo clippy` before committing ACKs for top commit: evanlinjin: ACK 08b745e Tree-SHA512: 7f1285c4baa5fb56fd65baa5585bd343338de9988b941618a2b9ab628d869563f6f71ce842f936e7e1fb6a56f2f1e50fc3deaff858e830b7039888e4e496ce9a
2 parents 3fa44a5 + 08b745e commit 8d916d7

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

crates/bdk/src/wallet/mod.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -992,12 +992,11 @@ impl<D> Wallet<D> {
992992
})
993993
}
994994

995-
/// Computes total input value going from script pubkeys in the index (sent) and the total output
996-
/// value going to script pubkeys in the index (received) in `tx`.
995+
/// Compute the `tx`'s sent and received amounts (in satoshis).
997996
///
998-
/// For the `sent` to be computed correctly, the outputs being spent must have already been
999-
/// scanned by the index. Calculating received just uses the [`Transaction`] outputs directly,
1000-
/// so it will be correct even if it has not been scanned.
997+
/// This method returns a tuple `(sent, received)`. Sent is the sum of the txin amounts
998+
/// that spend from previous txouts tracked by this wallet. Received is the summation
999+
/// of this tx's outputs that send to script pubkeys tracked by this wallet.
10011000
///
10021001
/// # Examples
10031002
///

0 commit comments

Comments
 (0)