Struct grin_core::core::transaction::Input
source · pub struct Input {
pub features: OutputFeatures,
pub commit: Commitment,
}
Expand description
A transaction input.
Primarily a reference to an output being spent by the transaction.
Fields§
§features: OutputFeatures
The features of the output being spent. We will check maturity for coinbase output.
commit: Commitment
The commit referencing the output being spent.
Implementations§
source§impl Input
impl Input
The input for a transaction, which spends a pre-existing unspent output. The input commitment is a reproduction of the commitment of the output being spent. Input must also provide the original output features and the hash of the block the output originated from.
sourcepub fn new(features: OutputFeatures, commit: Commitment) -> Input
pub fn new(features: OutputFeatures, commit: Commitment) -> Input
Build a new input from the data required to identify and verify an output being spent.
sourcepub fn commitment(&self) -> Commitment
pub fn commitment(&self) -> Commitment
The input commitment which partially identifies the output being spent. In the presence of a fork we need additional info to uniquely identify the output. Specifically the block hash (to correctly calculate lock_height for coinbase outputs).
sourcepub fn is_coinbase(&self) -> bool
pub fn is_coinbase(&self) -> bool
Is this a coinbase input?
Trait Implementations§
source§impl AsRef<Commitment> for Input
impl AsRef<Commitment> for Input
source§fn as_ref(&self) -> &Commitment
fn as_ref(&self) -> &Commitment
source§impl<'de> Deserialize<'de> for Input
impl<'de> Deserialize<'de> for Input
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>,
source§impl From<&Input> for CommitWrapper
impl From<&Input> for CommitWrapper
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
source§impl From<Input> for CommitWrapper
impl From<Input> for CommitWrapper
source§impl Ord for Input
impl Ord for Input
source§impl PartialEq for Input
impl PartialEq for Input
source§impl PartialOrd for Input
impl PartialOrd for Input
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl Readable for Input
impl Readable for Input
Implementation of Readable for a transaction Input, defines how to read an Input from a binary stream.
source§impl Writeable for Input
impl Writeable for Input
Implementation of Writeable for a transaction Input, defines how to write an Input as binary.
impl Copy for Input
impl DefaultHashable for Input
impl Eq for Input
Auto Trait Implementations§
impl Freeze for Input
impl RefUnwindSafe for Input
impl Send for Input
impl Sync for Input
impl Unpin for Input
impl UnwindSafe for Input
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<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
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
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)