Skip to content

Commit 80d62e4

Browse files
committed
feat(core): Introduce MissingMarker
Marks a transaction as missing from the mempool and the latest timestamp of when it was missing.
1 parent 3b9f3c7 commit 80d62e4

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

crates/core/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,7 @@ pub use tx_update::*;
7171
mod merge;
7272
pub use merge::*;
7373

74+
mod missing_marker;
75+
pub use missing_marker::*;
76+
7477
pub mod spk_client;

crates/core/src/missing_marker.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
use bitcoin::Txid;
2+
3+
/// Marks a transaction as missing from the mempool.
4+
#[derive(Debug, Clone, PartialEq, Eq, Copy, PartialOrd, Ord, core::hash::Hash)]
5+
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
6+
pub struct MissingMarker {
7+
/// The txid of the transaction being marked.
8+
pub txid: Txid,
9+
/// The latest timestamp of when the transaction is missing from the mempool.
10+
pub last_missing: u64,
11+
}
12+
13+
impl From<(Txid, u64)> for MissingMarker {
14+
fn from((txid, last_missing): (Txid, u64)) -> Self {
15+
Self { txid, last_missing }
16+
}
17+
}
18+
19+
impl From<MissingMarker> for (Txid, u64) {
20+
fn from(marker: MissingMarker) -> Self {
21+
(marker.txid, marker.last_missing)
22+
}
23+
}

0 commit comments

Comments
 (0)