Struct snarkos_consensus::memory_pool::MemoryPool [−][src]
Stores transactions received by the server. Transaction entries will eventually be fetched by the miner and assembled into blocks.
Fields
transactions: HashMap<Vec<u8>, Entry<T>>
The mapping of all unconfirmed transaction IDs to their corresponding transaction data.
total_size_in_bytes: usize
The total size in bytes of the current memory pool.
Implementations
impl<T: Transaction> MemoryPool<T>
[src]
pub fn new() -> Self
[src]
Initialize a new memory pool with no transactions
pub fn from_storage<P: LoadableMerkleParameters>(
storage: &Ledger<T, P>
) -> Result<Self, ConsensusError>
[src]
storage: &Ledger<T, P>
) -> Result<Self, ConsensusError>
Load the memory pool from previously stored state in storage
pub fn store<P: LoadableMerkleParameters>(
&self,
storage: &Ledger<T, P>
) -> Result<(), ConsensusError>
[src]
&self,
storage: &Ledger<T, P>
) -> Result<(), ConsensusError>
Store the memory pool state to the database
pub fn insert<P: LoadableMerkleParameters>(
&mut self,
storage: &Ledger<T, P>,
entry: Entry<T>
) -> Result<Option<Vec<u8>>, ConsensusError>
[src]
&mut self,
storage: &Ledger<T, P>,
entry: Entry<T>
) -> Result<Option<Vec<u8>>, ConsensusError>
Adds entry to memory pool if valid in the current ledger.
pub fn cleanse<P: LoadableMerkleParameters>(
&mut self,
storage: &Ledger<T, P>
) -> Result<(), ConsensusError>
[src]
&mut self,
storage: &Ledger<T, P>
) -> Result<(), ConsensusError>
Cleanse the memory pool of outdated transactions.
pub fn remove(
&mut self,
entry: &Entry<T>
) -> Result<Option<Vec<u8>>, ConsensusError>
[src]
&mut self,
entry: &Entry<T>
) -> Result<Option<Vec<u8>>, ConsensusError>
Removes transaction from memory pool or error.
pub fn remove_by_hash(
&mut self,
transaction_id: &[u8]
) -> Result<Option<Entry<T>>, ConsensusError>
[src]
&mut self,
transaction_id: &[u8]
) -> Result<Option<Entry<T>>, ConsensusError>
Removes transaction from memory pool based on the transaction id.
pub fn contains(&self, entry: &Entry<T>) -> bool
[src]
Returns whether or not the memory pool contains the entry.
pub fn get_candidates<P: LoadableMerkleParameters>(
&self,
storage: &Ledger<T, P>,
max_size: usize
) -> Result<DPCTransactions<T>, ConsensusError>
[src]
&self,
storage: &Ledger<T, P>,
max_size: usize
) -> Result<DPCTransactions<T>, ConsensusError>
Get candidate transactions for a new block.
Trait Implementations
impl<T: Clone + Transaction> Clone for MemoryPool<T>
[src]
fn clone(&self) -> MemoryPool<T>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Debug + Transaction> Debug for MemoryPool<T>
[src]
impl<T: Transaction> Default for MemoryPool<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for MemoryPool<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for MemoryPool<T> where
T: Send,
T: Send,
impl<T> Sync for MemoryPool<T> where
T: Sync,
T: Sync,
impl<T> Unpin for MemoryPool<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for MemoryPool<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,