pub struct PreparedBlock {
pub block: Block,
pub height: u32,
pub input_utxos: HashMap<OutPoint, Coin>,
pub in_block_outputs: HashMap<OutPoint, InBlockOutput>,
pub execution_levels: TxExecutionLevels,
}Expand description
A block with pre-fetched UTXOs ready for verification.
This structure enables efficient verification by:
- Pre-fetching all required UTXOs in a single batch
- Tracking in-block outputs for same-block spending
- Providing execution levels for parallel verification
Fields§
§block: BlockThe Bitcoin block.
height: u32Block height.
input_utxos: HashMap<OutPoint, Coin>Pre-fetched UTXOs for inputs spending external outputs. Key: OutPoint being spent Value: The Coin (UTXO) data
in_block_outputs: HashMap<OutPoint, InBlockOutput>Outputs created within this block (for in-block spending).
execution_levels: TxExecutionLevelsTransaction execution levels for intra-block parallelism.
Implementations§
Source§impl PreparedBlock
impl PreparedBlock
Sourcepub fn prepare<P: UtxoProvider>(
block: Block,
height: u32,
utxo_provider: &P,
) -> Self
pub fn prepare<P: UtxoProvider>( block: Block, height: u32, utxo_provider: &P, ) -> Self
Prepare a block for verification by pre-fetching required UTXOs.
This method:
- Scans the block to identify all required outpoints
- Separates external UTXOs from in-block outputs
- Batch-fetches external UTXOs from the provider
- Builds execution levels for parallel verification
Sourcepub fn get_utxo(&self, outpoint: &OutPoint) -> Option<(TxOut, bool, u32)>
pub fn get_utxo(&self, outpoint: &OutPoint) -> Option<(TxOut, bool, u32)>
Get a UTXO needed for verification.
Checks in-block outputs first, then pre-fetched external UTXOs. Returns (TxOut, is_coinbase, coin_height).
Sourcepub fn missing_utxos(&self) -> Vec<OutPoint>
pub fn missing_utxos(&self) -> Vec<OutPoint>
Check if all required external UTXOs were found.
Returns a list of missing outpoints if any are missing.
Sourcepub fn block_hash(&self) -> BlockHash
pub fn block_hash(&self) -> BlockHash
Returns the block hash.
Sourcepub fn into_verified(
self,
script_verification_duration: Duration,
) -> VerifiedBlock
pub fn into_verified( self, script_verification_duration: Duration, ) -> VerifiedBlock
Convert to a VerifiedBlock after successful verification.
This transfers ownership of the pre-fetched UTXOs to the VerifiedBlock, allowing apply_verified_block to use them without re-fetching.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PreparedBlock
impl RefUnwindSafe for PreparedBlock
impl Send for PreparedBlock
impl Sync for PreparedBlock
impl Unpin for PreparedBlock
impl UnwindSafe for PreparedBlock
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
§fn checked_from<T>(t: T) -> Option<Self>where
Self: TryFrom<T>,
fn checked_from<T>(t: T) -> Option<Self>where
Self: TryFrom<T>,
§fn checked_into<T>(self) -> Option<T>where
Self: TryInto<T>,
fn checked_into<T>(self) -> Option<T>where
Self: TryInto<T>,
§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>
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>
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§impl<Src, Dest> IntoTuple<Dest> for Srcwhere
Dest: FromTuple<Src>,
impl<Src, Dest> IntoTuple<Dest> for Srcwhere
Dest: FromTuple<Src>,
fn into_tuple(self) -> Dest
§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
T. Read more§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from.§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T.