[][src]Struct grin_pool::transaction_pool::TransactionPool

pub struct TransactionPool {
    pub config: PoolConfig,
    pub txpool: Pool,
    pub stempool: Pool,
    pub reorg_cache: Arc<RwLock<VecDeque<PoolEntry>>>,
    pub blockchain: Arc<dyn BlockChain>,
    pub verifier_cache: Arc<RwLock<dyn VerifierCache>>,
    pub adapter: Arc<dyn PoolAdapter>,
}

Transaction pool implementation.

Fields

config: PoolConfig

Pool Config

txpool: Pool

Our transaction pool.

stempool: Pool

Our Dandelion "stempool".

reorg_cache: Arc<RwLock<VecDeque<PoolEntry>>>

Cache of previous txs in case of a re-org.

blockchain: Arc<dyn BlockChain>

The blockchain

verifier_cache: Arc<RwLock<dyn VerifierCache>>adapter: Arc<dyn PoolAdapter>

The pool adapter

Methods

impl TransactionPool[src]

pub fn new(
    config: PoolConfig,
    chain: Arc<dyn BlockChain>,
    verifier_cache: Arc<RwLock<dyn VerifierCache>>,
    adapter: Arc<dyn PoolAdapter>
) -> TransactionPool
[src]

Create a new transaction pool

pub fn chain_head(&self) -> Result<BlockHeader, PoolError>[src]

pub fn add_to_pool(
    &mut self,
    src: TxSource,
    tx: Transaction,
    stem: bool,
    header: &BlockHeader
) -> Result<(), PoolError>
[src]

Add the given tx to the pool, directing it to either the stempool or txpool based on stem flag provided.

pub fn evict_from_txpool(&mut self)[src]

pub fn truncate_reorg_cache(&mut self, cutoff: DateTime<Utc>)[src]

pub fn reconcile_reorg_cache(
    &mut self,
    header: &BlockHeader
) -> Result<(), PoolError>
[src]

pub fn reconcile_block(&mut self, block: &Block) -> Result<(), PoolError>[src]

Reconcile the transaction pool (both txpool and stempool) against the provided block.

pub fn retrieve_tx_by_kernel_hash(&self, hash: Hash) -> Option<Transaction>[src]

Retrieve individual transaction for the given kernel hash.

pub fn retrieve_transactions(
    &self,
    hash: Hash,
    nonce: u64,
    kern_ids: &[ShortId]
) -> (Vec<Transaction>, Vec<ShortId>)
[src]

Retrieve all transactions matching the provided "compact block" based on the kernel set. Note: we only look in the txpool for this (stempool is under embargo).

pub fn total_size(&self) -> usize[src]

Get the total size of the pool. Note: we only consider the txpool here as stempool is under embargo.

pub fn prepare_mineable_transactions(
    &self
) -> Result<Vec<Transaction>, PoolError>
[src]

Returns a vector of transactions from the txpool so we can build a block from them.

Auto Trait Implementations

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> UnsafeAny for T where
    T: Any

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Erased for T