pub struct Mempool {
pub blocks_queue: VecDeque<Block>,
pub transactions: AHashMap<SaitoSignature, Transaction>,
pub golden_tickets: AHashMap<SaitoHash, (Transaction, bool)>,
pub new_tx_added: bool,
pub wallet_lock: Arc<RwLock<Wallet>>,
pub utxo_map: AHashMap<SaitoUTXOSetKey, u64>,
/* private fields */
}
Expand description
The Mempool
holds unprocessed blocks and transactions and is in control of
discerning when the node is allowed to create a block. It bundles the block and
sends it to the Blockchain
to be added to the longest-chain. New Block
s
received over the network are queued in the Mempool
before being added to
the Blockchain
Fields§
§blocks_queue: VecDeque<Block>
§transactions: AHashMap<SaitoSignature, Transaction>
§golden_tickets: AHashMap<SaitoHash, (Transaction, bool)>
§new_tx_added: bool
§wallet_lock: Arc<RwLock<Wallet>>
§utxo_map: AHashMap<SaitoUTXOSetKey, u64>
Implementations§
Source§impl Mempool
impl Mempool
pub fn new(wallet_lock: Arc<RwLock<Wallet>>) -> Self
pub fn add_block(&mut self, block: Block)
pub async fn add_golden_ticket(&mut self, golden_ticket: Transaction)
pub async fn add_transaction_if_validates( &mut self, transaction: Transaction, blockchain: &Blockchain, )
pub async fn add_transaction(&mut self, transaction: Transaction)
pub async fn bundle_block( &mut self, blockchain: &Blockchain, current_timestamp: Timestamp, gt_tx: Option<Transaction>, configs: &(dyn Configuration + Send + Sync), storage: &Storage, ) -> Option<Block>
pub async fn bundle_genesis_block( &mut self, blockchain: &mut Blockchain, current_timestamp: Timestamp, configs: &(dyn Configuration + Send + Sync), storage: &Storage, ) -> Block
pub async fn can_bundle_block( &self, blockchain: &Blockchain, current_timestamp: Timestamp, gt_tx: &Option<Transaction>, configs: &(dyn Configuration + Send + Sync), public_key: &SaitoPublicKey, ) -> Option<Currency>
pub fn delete_block(&mut self, block_hash: &SaitoHash)
pub fn delete_transactions(&mut self, transactions: &Vec<Transaction>)
Sourcepub fn get_routing_work_available(&self) -> Currency
pub fn get_routing_work_available(&self) -> Currency
Calculates the work available in mempool to produce a block
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Mempool
impl !RefUnwindSafe for Mempool
impl Send for Mempool
impl Sync for Mempool
impl Unpin for Mempool
impl !UnwindSafe for Mempool
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more