Type Alias chain_impl_mockchain::header::builder::HeaderBuilderNew
source · pub type HeaderBuilderNew = HeaderBuilder<HeaderSetParenting>;
Aliased Type§
struct HeaderBuilderNew(Header, PhantomData<HeaderSetParenting>);
Fields§
§0: Header
§1: PhantomData<HeaderSetParenting>
Implementations§
source§impl HeaderBuilderNew
impl HeaderBuilderNew
sourcepub fn new(version: BlockVersion, contents: &Contents) -> Self
pub fn new(version: BlockVersion, contents: &Contents) -> Self
Create a new Header builder starting from the full content.
This doesn’t need the content directly, but only uses the content to calculate the content hash and the content size, and make sure this is consistent
sourcepub fn new_raw(
version: BlockVersion,
content_hash: &BlockContentHash,
content_size: BlockContentSize
) -> Self
pub fn new_raw( version: BlockVersion, content_hash: &BlockContentHash, content_size: BlockContentSize ) -> Self
recommended to use new(), this is only for test
source§impl HeaderBuilder<HeaderSetParenting>
impl HeaderBuilder<HeaderSetParenting>
sourcepub fn set_genesis(self) -> HeaderBuilder<HeaderSetDate>
pub fn set_genesis(self) -> HeaderBuilder<HeaderSetDate>
Set the header as a genesis header:
- the depth starts at 0
- the parent is set to the “null hash” (hash all 0)
sourcepub fn set_parent(
self,
parent_hash: &HeaderId,
chain_length: ChainLength
) -> HeaderBuilder<HeaderSetDate>
pub fn set_parent( self, parent_hash: &HeaderId, chain_length: ChainLength ) -> HeaderBuilder<HeaderSetDate>
Set the header as a general block, with a specific depth and parent hash