Struct grin_core::core::transaction::TxKernel

source ·
pub struct TxKernel {
    pub features: KernelFeatures,
    pub excess: Commitment,
    pub excess_sig: Signature,
}
Expand description

A proof that a transaction sums to zero. Includes both the transaction’s Pedersen commitment and the signature, that guarantees that the commitments amount to zero. The signature signs the fee_fields and the lock_height, which are retained for signature validation.

Fields§

§features: KernelFeatures

Options for a kernel’s structure or use

§excess: Commitment

Remainder of the sum of all transaction commitments. If the transaction is well formed, amounts components should sum to zero and the excess is hence a valid public key (sum of the commitment public keys).

§excess_sig: Signature

The signature proving the excess is a valid public key, which signs the transaction fee_fields.

Implementations§

source§

impl TxKernel

source

pub fn is_coinbase(&self) -> bool

Is this a coinbase kernel?

source

pub fn is_plain(&self) -> bool

Is this a plain kernel?

source

pub fn is_height_locked(&self) -> bool

Is this a height locked kernel?

source

pub fn is_nrd(&self) -> bool

Is this an NRD kernel?

source

pub fn excess(&self) -> Commitment

Return the excess commitment for this tx_kernel.

source

pub fn msg_to_sign(&self) -> Result<Message, Error>

The msg signed as part of the tx kernel. Based on kernel features and associated fields (fee_fields and lock_height).

source

pub fn verify(&self) -> Result<(), Error>

Verify the transaction proof validity. Entails handling the commitment as a public key and checking the signature verifies with the fee_fields as message.

source

pub fn batch_sig_verify(tx_kernels: &[TxKernel]) -> Result<(), Error>

Batch signature verification.

source

pub fn empty() -> TxKernel

Build an empty tx kernel with zero values.

source

pub fn with_features(features: KernelFeatures) -> TxKernel

Build an empty tx kernel with the provided kernel features.

Trait Implementations§

source§

impl Clone for TxKernel

source§

fn clone(&self) -> TxKernel

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for TxKernel

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for TxKernel

source§

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 Hash for TxKernel

We want to be able to put kernels in a hashset in the pool. So we need to be able to hash them.

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Ord for TxKernel

source§

fn cmp(&self, other: &TxKernel) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PMMRable for TxKernel

We store kernels in the kernel MMR. Note: These are “variable size” to support different kernel feature variants.

§

type E = TxKernel

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) -> Self::E

Convert the pmmrable into the element to be stored in the MMR data file.
source§

fn elmt_size() -> Option<u16>

Size of each element if “fixed” size. Elements are “variable” size if None.
source§

impl PartialEq for TxKernel

source§

fn eq(&self, other: &TxKernel) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for TxKernel

source§

fn partial_cmp(&self, other: &TxKernel) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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 more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Readable for TxKernel

source§

fn read<R: Reader>(reader: &mut R) -> Result<TxKernel, Error>

Reads the data necessary to this Readable from the provided reader
source§

impl Serialize for TxKernel

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Writeable for TxKernel

source§

fn write<W: Writer>(&self, writer: &mut W) -> Result<(), Error>

Write the data held by this Writeable to the provided writer
source§

impl Copy for TxKernel

source§

impl DefaultHashable for TxKernel

source§

impl Eq for TxKernel

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneAny for T
where T: Any + Clone,

source§

fn clone_any(&self) -> Box<dyn CloneAny>

source§

fn clone_any_send(&self) -> Box<dyn CloneAny + Send>
where T: Send,

source§

fn clone_any_sync(&self) -> Box<dyn CloneAny + Sync>
where T: Sync,

source§

fn clone_any_send_sync(&self) -> Box<dyn CloneAny + Send + Sync>
where T: Send + Sync,

source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<D> Hashed for D
where D: DefaultHashable,

source§

fn hash(&self) -> Hash

Obtain the hash of the object
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> PMMRIndexHashable for T
where T: DefaultHashable,

source§

fn hash_with_index(&self, index: u64) -> Hash

Hash with a given index
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<H> ShortIdentifiable for H
where H: Hashed,

source§

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)
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DebugAny for T
where T: Any + Debug,

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

source§

impl<T> UnsafeAny for T
where T: Any,