]> Untitled Git - bdk/commitdiff
feat(chain): Add `TxGraph::get_last_evicted`
author志宇 <hello@evanlinjin.me>
Sat, 14 Jun 2025 03:15:48 +0000 (13:15 +1000)
committer志宇 <hello@evanlinjin.me>
Fri, 18 Jul 2025 11:15:10 +0000 (11:15 +0000)
Ideally, this would be included as a field in `TxNode`, however that
would be a breaking change.

crates/chain/src/tx_graph.rs

index 713b6268e306a91dce07f81a9100beebc3f38581..1e2b7cede05bef9f08c0826a55a988e8a55ed0c0 100644 (file)
@@ -410,6 +410,13 @@ impl<A> TxGraph<A> {
         })
     }
 
+    /// Get the `last_evicted` timestamp of the given `txid`.
+    ///
+    /// Ideally, this would be included in [`TxNode`], but that would be a breaking change.
+    pub fn get_last_evicted(&self, txid: Txid) -> Option<u64> {
+        self.last_evicted.get(&txid).copied()
+    }
+
     /// Calculates the fee of a given transaction. Returns [`Amount::ZERO`] if `tx` is a coinbase
     /// transaction. Returns `OK(_)` if we have all the [`TxOut`]s being spent by `tx` in the
     /// graph (either as the full transactions or individual txouts).