@@ -2489,13 +2489,44 @@ impl Wallet {
2489
2489
self . stage . merge ( indexed_graph_changeset. into ( ) ) ;
2490
2490
}
2491
2491
2492
- /// Apply evictions of the given txids with their associated timestamps.
2492
+ /// Apply evictions of the given transaction IDs with their associated timestamps.
2493
2493
///
2494
- /// This means that any pending unconfirmed tx in this set will no longer be canonical by
2495
- /// default. Note that an evicted tx can become canonical if it is later seen again or
2496
- /// observed on-chain.
2494
+ /// This function is used to mark specific unconfirmed transactions as evicted from the mempool.
2495
+ /// Eviction means that these transactions are not considered canonical by default, and will
2496
+ /// no longer be part of the wallet's [`transactions`] set. This can happen for example when
2497
+ /// a transaction is dropped from the mempool due to low fees or conflicts with another
2498
+ /// transaction.
2497
2499
///
2498
- /// This stages the changes which need to be persisted.
2500
+ /// Only transactions that are currently unconfirmed and canonical are considered for eviction.
2501
+ /// Transactions that are not relevant to the wallet are ignored. Note that an evicted
2502
+ /// transaction can become canonical again if it is later observed on-chain or seen in the
2503
+ /// mempool with a higher priority (e.g., due to a fee bump).
2504
+ ///
2505
+ /// ## Parameters
2506
+ ///
2507
+ /// `evicted_txs`: An iterator of `(Txid, u64)` tuples, where:
2508
+ /// - `Txid`: The transaction ID of the transaction to be evicted.
2509
+ /// - `u64`: The timestamp indicating when the transaction was evicted from the mempool. This
2510
+ /// will usually correspond to the time of the latest chain sync. See docs for
2511
+ /// [`start_sync_with_revealed_spks`].
2512
+ ///
2513
+ /// ## Notes
2514
+ ///
2515
+ /// - Not all blockchain backends support automatic mempool eviction handling - this method may
2516
+ /// be used in such cases. It can also be used to negate the effect of
2517
+ /// [`apply_unconfirmed_txs`] for a particular transaction without the need for an additional
2518
+ /// sync.
2519
+ /// - The changes are staged in the wallet's internal state and must be persisted to ensure they
2520
+ /// are retained across wallet restarts. Use [`Wallet::take_staged`] to retrieve the staged
2521
+ /// changes and persist them to your database of choice.
2522
+ /// - Evicted transactions are removed from the wallet's canonical transaction set, but the data
2523
+ /// remains in the wallet's internal transaction graph for historical purposes.
2524
+ /// - Ensure that the timestamps provided are accurate and monotonically increasing, as they
2525
+ /// influence the wallet's canonicalization logic.
2526
+ ///
2527
+ /// [`transactions`]: Wallet::transactions
2528
+ /// [`apply_unconfirmed_txs`]: Wallet::apply_unconfirmed_txs
2529
+ /// [`start_sync_with_revealed_spks`]: Wallet::start_sync_with_revealed_spks
2499
2530
pub fn apply_evicted_txs ( & mut self , evicted_txs : impl IntoIterator < Item = ( Txid , u64 ) > ) {
2500
2531
let chain = & self . chain ;
2501
2532
let canon_txids: Vec < Txid > = self
0 commit comments