Struct near_primitives::test_utils::TestBlockBuilder
source · pub struct TestBlockBuilder { /* private fields */ }
Expand description
Builder class for blocks to make testing easier.
§Examples
// TODO(mm-near): change it to doc-tested code once we have easy way to create a genesis block. let signer = EmptyValidatorSigner::default(); let test_block = test_utils::TestBlockBuilder::new(prev, signer).height(33).build();
Implementations§
source§impl TestBlockBuilder
impl TestBlockBuilder
pub fn new(prev: &Block, signer: Arc<dyn ValidatorSigner>) -> Self
pub fn height(self, height: u64) -> Self
pub fn epoch_id(self, epoch_id: EpochId) -> Self
pub fn next_epoch_id(self, next_epoch_id: EpochId) -> Self
pub fn next_bp_hash(self, next_bp_hash: CryptoHash) -> Self
pub fn approvals(self, approvals: Vec<Option<Box<Signature>>>) -> Self
sourcepub fn block_merkle_tree(
self,
block_merkle_tree: &mut PartialMerkleTree
) -> Self
pub fn block_merkle_tree( self, block_merkle_tree: &mut PartialMerkleTree ) -> Self
Updates the merkle tree by adding the previous hash, and updates the new block’s merkle_root.
pub fn build(self) -> Block
Auto Trait Implementations§
impl Freeze for TestBlockBuilder
impl !RefUnwindSafe for TestBlockBuilder
impl Send for TestBlockBuilder
impl Sync for TestBlockBuilder
impl Unpin for TestBlockBuilder
impl !UnwindSafe for TestBlockBuilder
Blanket Implementations§
source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more