stratus/eth/primitives/
pending_block.rsuse display_json::DebugAsJson;
use indexmap::IndexMap;
use crate::eth::primitives::BlockNumber;
use crate::eth::primitives::ExternalBlock;
use crate::eth::primitives::Hash;
use crate::eth::primitives::PendingBlockHeader;
use crate::eth::primitives::TransactionExecution;
#[derive(DebugAsJson, Clone, Default, serde::Serialize)]
pub struct PendingBlock {
pub header: PendingBlockHeader,
pub transactions: IndexMap<Hash, TransactionExecution>,
pub external_block: Option<ExternalBlock>,
}
impl PendingBlock {
pub fn new_at_now(number: BlockNumber) -> Self {
Self {
header: PendingBlockHeader::new_at_now(number),
transactions: IndexMap::new(),
external_block: None,
}
}
pub fn push_transaction(&mut self, tx: TransactionExecution) {
self.transactions.insert(tx.input.hash, tx);
}
}