@@ -2456,13 +2456,41 @@ impl Wallet {
2456
2456
self . stage . merge ( indexed_graph_changeset. into ( ) ) ;
2457
2457
}
2458
2458
2459
- /// Apply evictions of the given txids with their associated timestamps.
2459
+ /// Apply evictions of the given transaction IDs with their associated timestamps.
2460
2460
///
2461
- /// This means that any pending unconfirmed tx in this set will no longer be canonical by
2462
- /// default. Note that an evicted tx can become canonical if it is later seen again or
2463
- /// observed on-chain.
2461
+ /// This function is used to mark specific unconfirmed transactions as evicted from the mempool.
2462
+ /// Eviction means that these transactions are not considered canonical by default, and will
2463
+ /// no longer be part of the wallet's [`transactions`] set. This can happen for example when
2464
+ /// a transaction is dropped from the mempool due to low fees or conflicts with another
2465
+ /// transaction.
2464
2466
///
2465
- /// This stages the changes which need to be persisted.
2467
+ /// Only transactions that are currently unconfirmed and canonical are considered for eviction.
2468
+ /// Transactions that are not relevant to the wallet are ignored. Note that an evicted
2469
+ /// transaction can become canonical again if it is later observed on-chain or seen in the
2470
+ /// mempool with a higher priority (e.g., due to a fee bump).
2471
+ ///
2472
+ /// ## Parameters
2473
+ ///
2474
+ /// `evicted_txs`: An iterator of `(Txid, u64)` tuples, where:
2475
+ /// - `Txid`: The transaction ID of the transaction to be evicted.
2476
+ /// - `u64`: The timestamp indicating when the transaction was evicted from the mempool. This
2477
+ /// will usually correspond to the time of the latest chain sync. See docs for
2478
+ /// [`start_sync_with_revealed_spks`].
2479
+ ///
2480
+ /// ## Notes
2481
+ ///
2482
+ /// - This function is particularly useful when syncing with a blockchain backend that provides
2483
+ /// mempool eviction notifications.
2484
+ /// - The changes are staged in the wallet's internal state and must be persisted to ensure they
2485
+ /// are retained across wallet restarts. Use [`Wallet::take_staged`] to retrieve the staged
2486
+ /// changes and persist them to your database of choice.
2487
+ /// - Evicted transactions are removed from the wallet's canonical transaction set, but the data
2488
+ /// remains in the wallet's internal transaction graph for historical purposes.
2489
+ /// - Ensure that the timestamps provided are accurate and monotonically increasing, as they
2490
+ /// influence the wallet's canonicalization logic.
2491
+ ///
2492
+ /// [`transactions`]: Wallet::transactions
2493
+ /// [`start_sync_with_revealed_spks`]: Wallet::start_sync_with_revealed_spks
2466
2494
pub fn apply_evicted_txs ( & mut self , evicted_txs : impl IntoIterator < Item = ( Txid , u64 ) > ) {
2467
2495
let chain = & self . chain ;
2468
2496
let canon_txids: Vec < Txid > = self
0 commit comments