pub struct ChainStateBuilder<PersistedState: ChainStore> { /* private fields */ }Expand description
A builder for configuring and creating a ChainState.
It implements a few methods to access and modify the settings. Call .build() to consume the
builder and produce the ChainState.
Implementations§
Source§impl<T: ChainStore> ChainStateBuilder<T>
impl<T: ChainStore> ChainStateBuilder<T>
Sourcepub fn build(self) -> Result<ChainState<T>, BlockchainBuilderError>
pub fn build(self) -> Result<ChainState<T>, BlockchainBuilderError>
Builds the chain state. Returns error if the chainstore or chain_params are missing, or
if only one of tip_header and tip is set (either set both or none).
Sourcepub fn with_chainstore(self, chainstore: T) -> Self
pub fn with_chainstore(self, chainstore: T) -> Self
Set the chainstore backend, implementing ChainStore. Always required.
Sourcepub fn toggle_ibd(self, ibd: bool) -> Self
pub fn toggle_ibd(self, ibd: bool) -> Self
Enable or disable Initial Block Download (IBD) mode.
Sourcepub fn with_chain_params(self, chain_params: ChainParams) -> Self
pub fn with_chain_params(self, chain_params: ChainParams) -> Self
Sets the chain parameters. Always required.
Sourcepub fn with_assume_valid(self, arg: AssumeValidArg, network: Network) -> Self
pub fn with_assume_valid(self, arg: AssumeValidArg, network: Network) -> Self
Sets the assume-valid argument, which can be Disabled, Hardcoded or UserInput. This
option is used to skip script validation up to the specified block, speeding up IBD.
Sourcepub fn assume_utreexo(self, acc: Stump) -> Self
pub fn assume_utreexo(self, acc: Stump) -> Self
Sets the utreexo accumulator, assumed as the initial state.
Trait Implementations§
Source§impl<PersistedState: Clone + ChainStore> Clone for ChainStateBuilder<PersistedState>
impl<PersistedState: Clone + ChainStore> Clone for ChainStateBuilder<PersistedState>
Source§fn clone(&self) -> ChainStateBuilder<PersistedState>
fn clone(&self) -> ChainStateBuilder<PersistedState>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<PersistedState: Debug + ChainStore> Debug for ChainStateBuilder<PersistedState>
impl<PersistedState: Debug + ChainStore> Debug for ChainStateBuilder<PersistedState>
Source§impl<PersistedState: Default + ChainStore> Default for ChainStateBuilder<PersistedState>
impl<PersistedState: Default + ChainStore> Default for ChainStateBuilder<PersistedState>
Source§fn default() -> ChainStateBuilder<PersistedState>
fn default() -> ChainStateBuilder<PersistedState>
Returns the “default value” for a type. Read more
Source§impl<T: ChainStore> TryFrom<ChainStateBuilder<T>> for ChainState<T>
impl<T: ChainStore> TryFrom<ChainStateBuilder<T>> for ChainState<T>
Source§type Error = BlockchainBuilderError
type Error = BlockchainBuilderError
The type returned in the event of a conversion error.
Auto Trait Implementations§
impl<PersistedState> Freeze for ChainStateBuilder<PersistedState>where
PersistedState: Freeze,
impl<PersistedState> RefUnwindSafe for ChainStateBuilder<PersistedState>where
PersistedState: RefUnwindSafe,
impl<PersistedState> Send for ChainStateBuilder<PersistedState>where
PersistedState: Send,
impl<PersistedState> Sync for ChainStateBuilder<PersistedState>where
PersistedState: Sync,
impl<PersistedState> Unpin for ChainStateBuilder<PersistedState>where
PersistedState: Unpin,
impl<PersistedState> UnwindSafe for ChainStateBuilder<PersistedState>where
PersistedState: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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