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

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

Transaction pool implementation.

Fields

config: PoolConfig

Pool Config

txpool: Pool<B, V>

Our transaction pool.

stempool: Pool<B, V>

Our Dandelion "stempool".

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

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

blockchain: Arc<B>

The blockchain

verifier_cache: Arc<RwLock<V>>adapter: Arc<P>

The pool adapter

Implementations

impl<B, P, V> TransactionPool<B, P, V> where
    B: BlockChain,
    P: PoolAdapter,
    V: VerifierCache + 'static, 
[src]

pub fn new(
    config: PoolConfig,
    chain: Arc<B>,
    verifier_cache: Arc<RwLock<V>>,
    adapter: Arc<P>
) -> Self
[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

impl<B, P, V> !RefUnwindSafe for TransactionPool<B, P, V>[src]

impl<B, P, V> Send for TransactionPool<B, P, V>[src]

impl<B, P, V> Sync for TransactionPool<B, P, V>[src]

impl<B, P, V> Unpin for TransactionPool<B, P, V>[src]

impl<B, P, V> !UnwindSafe for TransactionPool<B, P, V>[src]

Blanket Implementations

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

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

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

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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> UnsafeAny for T where
    T: Any