Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions crates/chain/src/tx_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ pub struct TxNode<'a, T, A> {
pub first_seen: Option<u64>,
/// The last-seen unix timestamp of the transaction as unconfirmed.
pub last_seen: Option<u64>,
/// The last-evicted-from-mempool unix timestamp of the transaction.
pub last_evicted: Option<u64>,
}

impl<T, A> Deref for TxNode<'_, T, A> {
Expand Down Expand Up @@ -342,6 +344,7 @@ impl<A> TxGraph<A> {
anchors: self.anchors.get(&txid).unwrap_or(&self.empty_anchors),
first_seen: self.first_seen.get(&txid).copied(),
last_seen: self.last_seen.get(&txid).copied(),
last_evicted: self.last_evicted.get(&txid).copied(),
}),
TxNodeInternal::Partial(_) => None,
})
Expand Down Expand Up @@ -378,6 +381,7 @@ impl<A> TxGraph<A> {
anchors: self.anchors.get(&txid).unwrap_or(&self.empty_anchors),
first_seen: self.first_seen.get(&txid).copied(),
last_seen: self.last_seen.get(&txid).copied(),
last_evicted: self.last_evicted.get(&txid).copied(),
}),
_ => None,
}
Expand Down Expand Up @@ -410,13 +414,6 @@ 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).
Expand Down
Loading