[][src]Struct grin_pool::Pool

pub struct Pool<B, V> where
    B: BlockChain,
    V: VerifierCache
{ pub entries: Vec<PoolEntry>, pub blockchain: Arc<B>, pub verifier_cache: Arc<RwLock<V>>, pub name: String, }

Fields

entries: Vec<PoolEntry>

Entries in the pool (tx + info + timer) in simple insertion order.

blockchain: Arc<B>

The blockchain

verifier_cache: Arc<RwLock<V>>name: String

Implementations

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

pub fn new(chain: Arc<B>, verifier_cache: Arc<RwLock<V>>, name: String) -> Self[src]

pub fn contains_tx(&self, tx: &Transaction) -> bool[src]

Does the transaction pool contain an entry for the given transaction? Transactions are compared by their kernels.

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

Query the tx pool for an individual tx matching the given kernel hash.

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

Query the tx pool for all known txs based on kernel short_ids from the provided compact_block. Note: does not validate that we return the full set of required txs. The caller will need to validate that themselves.

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

Take pool transactions, filtering and ordering them in a way that's appropriate to put in a mined block. Aggregates chains of dependent transactions, orders by fee over weight and ensures the total weight does not exceed the provided max_weight (miner defined block weight).

pub fn all_transactions(&self) -> Vec<Transaction>[src]

pub fn all_transactions_aggregate(
    &self,
    extra_tx: Option<Transaction>
) -> Result<Option<Transaction>, PoolError>
[src]

Return a single aggregate tx representing all txs in the pool. Takes an optional "extra tx" to include in the aggregation. Returns None if there is nothing to aggregate. Returns the extra tx if provided and pool is empty.

pub fn add_to_pool(
    &mut self,
    entry: PoolEntry,
    extra_tx: Option<Transaction>,
    header: &BlockHeader
) -> Result<(), PoolError>
[src]

pub fn validate_raw_txs(
    &self,
    txs: &[Transaction],
    extra_tx: Option<Transaction>,
    header: &BlockHeader,
    weighting: Weighting
) -> Result<Vec<Transaction>, PoolError>
[src]

pub fn locate_spends(
    &self,
    tx: &Transaction,
    extra_tx: Option<Transaction>
) -> Result<(Vec<OutputIdentifier>, Vec<OutputIdentifier>), PoolError>
[src]

Lookup unspent outputs to be spent by the provided transaction. We look for unspent outputs in the current txpool and then in the current utxo.

pub fn reconcile(
    &mut self,
    extra_tx: Option<Transaction>,
    header: &BlockHeader
) -> Result<(), PoolError>
[src]

pub fn evict_transaction(&mut self)[src]

pub fn find_matching_transactions(
    &self,
    kernels: &[TxKernel]
) -> Vec<Transaction>
[src]

TODO - This is kernel based. How does this interact with NRD?

pub fn reconcile_block(&mut self, block: &Block)[src]

Quick reconciliation step - we can evict any txs in the pool where inputs or kernels intersect with the block.

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

Size of the pool.

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

Number of transaction kernels in the pool. This may differ from the size (number of transactions) due to tx aggregation.

pub fn is_empty(&self) -> bool[src]

Is the pool empty?

Auto Trait Implementations

impl<B, V> !RefUnwindSafe for Pool<B, V>

impl<B, V> Send for Pool<B, V>

impl<B, V> Sync for Pool<B, V>

impl<B, V> Unpin for Pool<B, V>

impl<B, V> !UnwindSafe for Pool<B, V>

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