Struct grin_core::core::transaction::OutputIdentifier
source · pub struct OutputIdentifier {
pub features: OutputFeatures,
pub commit: Commitment,
}
Expand description
An output_identifier can be build from either an input or an output and contains everything we need to uniquely identify an output being spent. Needed because it is not sufficient to pass a commitment around.
Fields§
§features: OutputFeatures
Output features (coinbase vs. regular transaction output) We need to include this when hashing to ensure coinbase maturity can be enforced.
commit: Commitment
Output commitment
Implementations§
source§impl OutputIdentifier
impl OutputIdentifier
sourcepub fn new(features: OutputFeatures, commit: &Commitment) -> OutputIdentifier
pub fn new(features: OutputFeatures, commit: &Commitment) -> OutputIdentifier
Build a new output_identifier.
sourcepub fn commitment(&self) -> Commitment
pub fn commitment(&self) -> Commitment
Our commitment.
sourcepub fn is_coinbase(&self) -> bool
pub fn is_coinbase(&self) -> bool
Is this a coinbase output?
sourcepub fn into_output(self, proof: RangeProof) -> Output
pub fn into_output(self, proof: RangeProof) -> Output
Converts this identifier to a full output, provided a RangeProof
Trait Implementations§
source§impl AsRef<Commitment> for OutputIdentifier
impl AsRef<Commitment> for OutputIdentifier
source§fn as_ref(&self) -> &Commitment
fn as_ref(&self) -> &Commitment
Converts this type into a shared reference of the (usually inferred) input type.
source§impl AsRef<OutputIdentifier> for Output
impl AsRef<OutputIdentifier> for Output
source§fn as_ref(&self) -> &OutputIdentifier
fn as_ref(&self) -> &OutputIdentifier
Converts this type into a shared reference of the (usually inferred) input type.
source§impl AsRef<OutputIdentifier> for OutputIdentifier
impl AsRef<OutputIdentifier> for OutputIdentifier
source§fn as_ref(&self) -> &OutputIdentifier
fn as_ref(&self) -> &OutputIdentifier
Converts this type into a shared reference of the (usually inferred) input type.
source§impl Clone for OutputIdentifier
impl Clone for OutputIdentifier
source§fn clone(&self) -> OutputIdentifier
fn clone(&self) -> OutputIdentifier
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 Debug for OutputIdentifier
impl Debug for OutputIdentifier
source§impl<'de> Deserialize<'de> for OutputIdentifier
impl<'de> Deserialize<'de> for OutputIdentifier
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl From<&Input> for OutputIdentifier
impl From<&Input> for OutputIdentifier
source§impl From<&OutputIdentifier> for Input
impl From<&OutputIdentifier> for Input
source§fn from(out: &OutputIdentifier) -> Self
fn from(out: &OutputIdentifier) -> Self
Converts to this type from the input type.
source§impl Ord for OutputIdentifier
impl Ord for OutputIdentifier
source§fn cmp(&self, other: &OutputIdentifier) -> Ordering
fn cmp(&self, other: &OutputIdentifier) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PMMRable for OutputIdentifier
impl PMMRable for OutputIdentifier
§type E = OutputIdentifier
type E = OutputIdentifier
The type of element actually stored in the MMR data file.
This allows us to store Hash elements in the header MMR for variable size BlockHeaders.
source§fn as_elmt(&self) -> OutputIdentifier
fn as_elmt(&self) -> OutputIdentifier
Convert the pmmrable into the element to be stored in the MMR data file.
source§impl PartialEq for OutputIdentifier
impl PartialEq for OutputIdentifier
source§fn eq(&self, other: &OutputIdentifier) -> bool
fn eq(&self, other: &OutputIdentifier) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for OutputIdentifier
impl PartialOrd for OutputIdentifier
source§fn partial_cmp(&self, other: &OutputIdentifier) -> Option<Ordering>
fn partial_cmp(&self, other: &OutputIdentifier) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl Readable for OutputIdentifier
impl Readable for OutputIdentifier
source§impl Serialize for OutputIdentifier
impl Serialize for OutputIdentifier
source§impl Writeable for OutputIdentifier
impl Writeable for OutputIdentifier
impl Copy for OutputIdentifier
impl DefaultHashable for OutputIdentifier
impl Eq for OutputIdentifier
Auto Trait Implementations§
impl Freeze for OutputIdentifier
impl RefUnwindSafe for OutputIdentifier
impl Send for OutputIdentifier
impl Sync for OutputIdentifier
impl Unpin for OutputIdentifier
impl UnwindSafe for OutputIdentifier
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<D> Hashed for Dwhere
D: DefaultHashable,
impl<D> Hashed for Dwhere
D: DefaultHashable,
source§impl<T> PMMRIndexHashable for Twhere
T: DefaultHashable,
impl<T> PMMRIndexHashable for Twhere
T: DefaultHashable,
source§fn hash_with_index(&self, index: u64) -> Hash
fn hash_with_index(&self, index: u64) -> Hash
Hash with a given index
source§impl<H> ShortIdentifiable for Hwhere
H: Hashed,
impl<H> ShortIdentifiable for Hwhere
H: Hashed,
source§fn short_id(&self, hash: &Hash, nonce: u64) -> ShortId
fn short_id(&self, hash: &Hash, nonce: u64) -> ShortId
Generate a short_id via the following -
- extract k0/k1 from block_hash hashed with the nonce (first two u64
values) * initialize a siphasher24 with k0/k1
- self.hash() passing in the siphasher24 instance
- drop the 2 most significant bytes (to return a 6 byte short_id)