Skip to content

Commit 73bef28

Browse files
committed
doc(tx_builder): add info about manually selected UTxOs priority
1 parent 3316236 commit 73bef28

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

wallet/src/wallet/tx_builder.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,8 @@ impl<'a, Cs> TxBuilder<'a, Cs> {
276276
///
277277
/// These have priority over the "unspendable" UTXOs, meaning that if a UTXO is present both in
278278
/// the "UTXOs" and the "unspendable" list, it will be spent.
279+
///
280+
/// If a UTXO is inserted multiple times, only the final insertion will take effect.
279281
pub fn add_utxos(&mut self, outpoints: &[OutPoint]) -> Result<&mut Self, AddUtxoError> {
280282
// Canonicalize once, instead of once for every call to `get_utxo`.
281283
let unspent: HashMap<OutPoint, LocalOutput> = self
@@ -327,6 +329,10 @@ impl<'a, Cs> TxBuilder<'a, Cs> {
327329

328330
/// Add a foreign UTXO i.e. a UTXO not known by this wallet.
329331
///
332+
/// Foreign UTXOs are not prioritized over local UTXOs. If a local UTXO is added to the
333+
/// manually selected list, it will replace any conflicting foreign UTXOs. However, a foreign
334+
/// UTXO cannot replace a conflicting local UTXO.
335+
///
330336
/// There might be cases where the UTXO belongs to the wallet but it doesn't have knowledge of
331337
/// it. This is possible if the wallet is not synced or its not being use to track
332338
/// transactions. In those cases is the responsibility of the user to add any possible local

0 commit comments

Comments
 (0)