From: vmammal Date: Wed, 17 Jan 2024 18:00:27 +0000 (-0500) Subject: doc(wallet): improve docs for `Wallet::sent_and_received` X-Git-Tag: v1.0.0-alpha.5~16^2 X-Git-Url: http://internal-gitweb-vhost/script/%22https:/struct.EncoderStringWriter.html?a=commitdiff_plain;h=08b745ec9f16fa8ef18b0d9c92feb9d8ab87a184;p=bdk doc(wallet): improve docs for `Wallet::sent_and_received` --- diff --git a/crates/bdk/src/wallet/mod.rs b/crates/bdk/src/wallet/mod.rs index ce152cb5..ab78b36b 100644 --- a/crates/bdk/src/wallet/mod.rs +++ b/crates/bdk/src/wallet/mod.rs @@ -914,12 +914,11 @@ impl Wallet { }) } - /// Computes total input value going from script pubkeys in the index (sent) and the total output - /// value going to script pubkeys in the index (received) in `tx`. + /// Compute the `tx`'s sent and received amounts (in satoshis). /// - /// For the `sent` to be computed correctly, the outputs being spent must have already been - /// scanned by the index. Calculating received just uses the [`Transaction`] outputs directly, - /// so it will be correct even if it has not been scanned. + /// This method returns a tuple `(sent, received)`. Sent is the sum of the txin amounts + /// that spend from previous txouts tracked by this wallet. Received is the summation + /// of this tx's outputs that send to script pubkeys tracked by this wallet. /// /// # Examples ///