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
impl TxKernel
sourcepub fn is_coinbase(&self) -> bool
pub fn is_coinbase(&self) -> bool
Is this a coinbase kernel?
sourcepub fn is_height_locked(&self) -> bool
pub fn is_height_locked(&self) -> bool
Is this a height locked kernel?
sourcepub fn excess(&self) -> Commitment
pub fn excess(&self) -> Commitment
Return the excess commitment for this tx_kernel.
sourcepub fn msg_to_sign(&self) -> Result<Message, Error>
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).
sourcepub fn verify(&self) -> Result<(), Error>
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.
sourcepub fn batch_sig_verify(tx_kernels: &[TxKernel]) -> Result<(), Error>
pub fn batch_sig_verify(tx_kernels: &[TxKernel]) -> Result<(), Error>
Batch signature verification.
sourcepub fn with_features(features: KernelFeatures) -> TxKernel
pub fn with_features(features: KernelFeatures) -> TxKernel
Build an empty tx kernel with the provided kernel features.
Trait Implementations§
source§impl<'de> Deserialize<'de> for TxKernel
impl<'de> Deserialize<'de> for TxKernel
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 Hash for TxKernel
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§impl Ord for TxKernel
impl Ord for TxKernel
source§impl PMMRable for TxKernel
impl PMMRable for TxKernel
We store kernels in the kernel MMR. Note: These are “variable size” to support different kernel feature variants.
source§impl PartialEq for TxKernel
impl PartialEq for TxKernel
source§impl PartialOrd for TxKernel
impl PartialOrd for TxKernel
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 moreimpl Copy for TxKernel
impl DefaultHashable for TxKernel
impl Eq for TxKernel
Auto Trait Implementations§
impl Freeze for TxKernel
impl RefUnwindSafe for TxKernel
impl Send for TxKernel
impl Sync for TxKernel
impl Unpin for TxKernel
impl UnwindSafe for TxKernel
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)