]> Untitled Git - bdk/commitdiff
doc(wallet): improve docs for `Wallet::sent_and_received`
authorvmammal <valuedmammal@protonmail.com>
Wed, 17 Jan 2024 18:00:27 +0000 (13:00 -0500)
committervmammal <valuedmammal@protonmail.com>
Thu, 18 Jan 2024 15:24:20 +0000 (10:24 -0500)
crates/bdk/src/wallet/mod.rs

index ce152cb5ede509a12ddf496cc5ba4b4d43ecd7fd..ab78b36bbc3004be1149fd02b7c5d7b365993581 100644 (file)
@@ -914,12 +914,11 @@ impl<D> Wallet<D> {
         })
     }
 
-    /// 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
     ///