1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//! TX verification cache

use ckb_types::{
    core::{Capacity, Cycle},
    packed::Byte32,
};

/// TX verification lru cache
pub type TxVerifyCache = lru::LruCache<Byte32, CacheEntry>;

/// TX verification lru entry
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CacheEntry {
    /// Cached tx cycles
    pub cycles: Cycle,
    /// Cached tx fee
    pub fee: Capacity,
}

impl CacheEntry {
    /// Constructs a CacheEntry
    pub fn new(cycles: Cycle, fee: Capacity) -> Self {
        CacheEntry { cycles, fee }
    }
}