File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -2367,6 +2367,35 @@ impl Wallet {
2367
2367
self . stage . merge ( indexed_graph_changeset. into ( ) ) ;
2368
2368
}
2369
2369
2370
+ /// Apply evictions of the given txids with their associated timestamps.
2371
+ ///
2372
+ /// This means that any pending unconfirmed tx in this set will no longer be canonical by
2373
+ /// default. Note that an evicted tx can become canonical if it is later seen again or
2374
+ /// observed on-chain.
2375
+ ///
2376
+ /// This stages the changes which need to be persisted.
2377
+ pub fn apply_evicted_txs ( & mut self , evicted_txs : impl IntoIterator < Item = ( Txid , u64 ) > ) {
2378
+ let chain = & self . chain ;
2379
+ let canon_txids: Vec < Txid > = self
2380
+ . indexed_graph
2381
+ . graph ( )
2382
+ . list_canonical_txs (
2383
+ chain,
2384
+ chain. tip ( ) . block_id ( ) ,
2385
+ CanonicalizationParams :: default ( ) ,
2386
+ )
2387
+ . map ( |c| c. tx_node . txid )
2388
+ . collect ( ) ;
2389
+
2390
+ let changeset = self . indexed_graph . batch_insert_relevant_evicted_at (
2391
+ evicted_txs
2392
+ . into_iter ( )
2393
+ . filter ( |( txid, _) | canon_txids. contains ( txid) ) ,
2394
+ ) ;
2395
+
2396
+ self . stage . merge ( changeset. into ( ) ) ;
2397
+ }
2398
+
2370
2399
/// Used internally to ensure that all methods requiring a [`KeychainKind`] will use a
2371
2400
/// keychain with an associated descriptor. For example in case the wallet was created
2372
2401
/// with only one keychain, passing [`KeychainKind::Internal`] here will instead return
You can’t perform that action at this time.
0 commit comments