pub struct UTXOView<'a> { /* private fields */ }Expand description
Readonly view of the UTXO set (based on output MMR).
Implementations§
Source§impl<'a> UTXOView<'a>
impl<'a> UTXOView<'a>
Sourcepub fn new(
header_pmmr: ReadonlyPMMR<'a, BlockHeader, PMMRBackend<BlockHeader>>,
output_pmmr: ReadonlyPMMR<'a, OutputIdentifier, PMMRBackend<OutputIdentifier>>,
rproof_pmmr: ReadonlyPMMR<'a, RangeProof, PMMRBackend<RangeProof>>,
) -> UTXOView<'a>
pub fn new( header_pmmr: ReadonlyPMMR<'a, BlockHeader, PMMRBackend<BlockHeader>>, output_pmmr: ReadonlyPMMR<'a, OutputIdentifier, PMMRBackend<OutputIdentifier>>, rproof_pmmr: ReadonlyPMMR<'a, RangeProof, PMMRBackend<RangeProof>>, ) -> UTXOView<'a>
Build a new UTXO view.
Sourcepub fn validate_block(
&self,
block: &Block,
batch: &Batch<'_>,
) -> Result<Vec<(OutputIdentifier, CommitPos)>, Error>
pub fn validate_block( &self, block: &Block, batch: &Batch<'_>, ) -> Result<Vec<(OutputIdentifier, CommitPos)>, Error>
Validate a block against the current UTXO set. Every input must spend an output that currently exists in the UTXO set. No duplicate outputs.
Sourcepub fn validate_tx(
&self,
tx: &Transaction,
batch: &Batch<'_>,
) -> Result<Vec<(OutputIdentifier, CommitPos)>, Error>
pub fn validate_tx( &self, tx: &Transaction, batch: &Batch<'_>, ) -> Result<Vec<(OutputIdentifier, CommitPos)>, Error>
Validate a transaction against the current UTXO set. Every input must spend an output that currently exists in the UTXO set. No duplicate outputs.
Sourcepub fn validate_inputs(
&self,
inputs: &Inputs,
batch: &Batch<'_>,
) -> Result<Vec<(OutputIdentifier, CommitPos)>, Error>
pub fn validate_inputs( &self, inputs: &Inputs, batch: &Batch<'_>, ) -> Result<Vec<(OutputIdentifier, CommitPos)>, Error>
Validate the provided inputs. Returns a vec of output identifiers corresponding to outputs that would be spent by the provided inputs.
Sourcepub fn get_unspent_output_at(&self, pos0: u64) -> Result<Output, Error>
pub fn get_unspent_output_at(&self, pos0: u64) -> Result<Output, Error>
Retrieves an unspent output using its PMMR position
Sourcepub fn verify_coinbase_maturity(
&self,
inputs: &Inputs,
height: u64,
batch: &Batch<'_>,
) -> Result<(), Error>
pub fn verify_coinbase_maturity( &self, inputs: &Inputs, height: u64, batch: &Batch<'_>, ) -> Result<(), Error>
Verify we are not attempting to spend any coinbase outputs that have not sufficiently matured.
Sourcepub fn get_header_by_height(
&self,
height: u64,
batch: &Batch<'_>,
) -> Result<BlockHeader, Error>
pub fn get_header_by_height( &self, height: u64, batch: &Batch<'_>, ) -> Result<BlockHeader, Error>
Get the header at the specified height based on the current state of the extension. Derives the MMR pos from the height (insertion index) and retrieves the header hash. Looks the header up in the db by hash.
Auto Trait Implementations§
impl<'a> Freeze for UTXOView<'a>
impl<'a> RefUnwindSafe for UTXOView<'a>
impl<'a> Send for UTXOView<'a>
impl<'a> Sync for UTXOView<'a>
impl<'a> Unpin for UTXOView<'a>
impl<'a> UnwindSafe for UTXOView<'a>
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
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