use brk_types::{FeeRate, Sats, Timestamp, Txid, TxidPrefix, VSize};
use smallvec::SmallVec;
#[derive(Debug, Clone)]
pub struct Entry {
pub txid: Txid,
pub fee: Sats,
pub vsize: VSize,
pub size: u64,
pub ancestor_fee: Sats,
pub ancestor_vsize: VSize,
pub depends: SmallVec<[TxidPrefix; 2]>,
pub first_seen: Timestamp,
}
impl Entry {
#[inline]
pub fn fee_rate(&self) -> FeeRate {
FeeRate::from((self.fee, self.vsize))
}
#[inline]
pub fn ancestor_fee_rate(&self) -> FeeRate {
FeeRate::from((self.ancestor_fee, self.ancestor_vsize))
}
#[inline]
pub fn effective_fee_rate(&self) -> FeeRate {
self.fee_rate().max(self.ancestor_fee_rate())
}
#[inline]
pub fn txid_prefix(&self) -> TxidPrefix {
TxidPrefix::from(&self.txid)
}
}