Skip to content

Commit f616d6b

Browse files
committed
feat(api): create MempoolStats struct
1 parent a414514 commit f616d6b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/api.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,23 @@ pub struct OutputSpendStatus {
230230
pub status: Option<UtxoStatus>,
231231
}
232232

233+
/// Statistics about the mempool.
234+
#[derive(Clone, Debug, PartialEq, Deserialize)]
235+
pub struct MempoolStats {
236+
/// The number of transactions in the mempool.
237+
pub count: usize,
238+
/// The total size of mempool transactions in virtual bytes.
239+
pub vsize: usize,
240+
/// The total fee paid by mempool transactions, in sats.
241+
pub total_fee: u64,
242+
/// The mempool's fee rate distribution histogram.
243+
///
244+
/// An array of `(feerate, vsize)` tuples, where each entry's `vsize` is the total vsize
245+
/// of transactions paying more than `feerate` but less than the previous entry's `feerate`
246+
/// (except for the first entry, which has no upper bound).
247+
pub fee_histogram: Vec<(f64, usize)>,
248+
}
249+
233250
impl Tx {
234251
pub fn to_tx(&self) -> Transaction {
235252
Transaction {

0 commit comments

Comments
 (0)