Skip to content

Commit 1cd9946

Browse files
committed
feat(api): create MempoolStats struct
1 parent 14a04e3 commit 1cd9946

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
@@ -229,6 +229,23 @@ pub struct OutputSpendStatus {
229229
pub status: Option<UtxoStatus>,
230230
}
231231

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

0 commit comments

Comments
 (0)