pub struct OpenBlock<'x> { /* private fields */ }
Expand description
Block that is ready for transactions to be added.
It’s a bit like a Vecstate()
. We also archive execution receipts in preparation for later block creation.
Implementations
sourceimpl<'x> OpenBlock<'x>
impl<'x> OpenBlock<'x>
sourcepub fn new<'a, I: IntoIterator<Item = ExtendedHeader>>(
engine: &'x dyn EthEngine,
factories: Factories,
tracing: bool,
db: StateDB,
parent: &Header,
last_hashes: Arc<LastHashes>,
author: Address,
gas_range_target: (U256, U256),
extra_data: Bytes,
is_epoch_begin: bool,
ancestry: I
) -> Result<Self, Error>
pub fn new<'a, I: IntoIterator<Item = ExtendedHeader>>(
engine: &'x dyn EthEngine,
factories: Factories,
tracing: bool,
db: StateDB,
parent: &Header,
last_hashes: Arc<LastHashes>,
author: Address,
gas_range_target: (U256, U256),
extra_data: Bytes,
is_epoch_begin: bool,
ancestry: I
) -> Result<Self, Error>
t_nb 8.1 Create a new OpenBlock
ready for transaction pushing.
sourcepub fn set_timestamp(&mut self, timestamp: u64)
pub fn set_timestamp(&mut self, timestamp: u64)
Alter the timestamp of the block.
sourcepub fn remove_gas_limit(&mut self)
pub fn remove_gas_limit(&mut self)
Removes block gas limit.
sourcepub fn set_gas_limit(&mut self, gas_limit: U256)
pub fn set_gas_limit(&mut self, gas_limit: U256)
Set block gas limit.
sourcepub fn push_uncle(
&mut self,
valid_uncle_header: Header
) -> Result<(), BlockError>
pub fn push_uncle(
&mut self,
valid_uncle_header: Header
) -> Result<(), BlockError>
NOTE Will check chain constraints and the uncle number but will NOT check that the header itself is actually valid.
sourcepub fn push_transaction(
&mut self,
t: SignedTransaction,
h: Option<H256>
) -> Result<&TypedReceipt, Error>
pub fn push_transaction(
&mut self,
t: SignedTransaction,
h: Option<H256>
) -> Result<&TypedReceipt, Error>
Push a transaction into the block.
If valid, it will be executed, and archived together with the receipt.
sourcepub fn close(self) -> Result<ClosedBlock, Error>
pub fn close(self) -> Result<ClosedBlock, Error>
Turn this into a ClosedBlock
.
sourcepub fn close_and_lock(self) -> Result<LockedBlock, Error>
pub fn close_and_lock(self) -> Result<LockedBlock, Error>
t_nb 8.5 Turn this into a LockedBlock
.
Methods from Deref<Target = ExecutedBlock>
Trait Implementations
Auto Trait Implementations
impl<'x> !RefUnwindSafe for OpenBlock<'x>
impl<'x> Send for OpenBlock<'x>
impl<'x> !Sync for OpenBlock<'x>
impl<'x> Unpin for OpenBlock<'x>
impl<'x> !UnwindSafe for OpenBlock<'x>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more