[−][src]Struct grin_core::core::transaction::Transaction
A transaction
Fields
offset: BlindingFactor
The kernel "offset" k2 excess is k1G after splitting the key k = k1 + k2
Methods
impl Transaction
[src]
impl Transaction
pub fn empty() -> Transaction
[src]
pub fn empty() -> Transaction
Creates a new empty transaction (no inputs or outputs, zero fee).
pub fn new(
inputs: Vec<Input>,
outputs: Vec<Output>,
kernels: Vec<TxKernel>
) -> Transaction
[src]
pub fn new(
inputs: Vec<Input>,
outputs: Vec<Output>,
kernels: Vec<TxKernel>
) -> Transaction
Creates a new transaction initialized with the provided inputs, outputs, kernels
pub fn with_offset(self, offset: BlindingFactor) -> Transaction
[src]
pub fn with_offset(self, offset: BlindingFactor) -> Transaction
Creates a new transaction using this transaction as a template and with the specified offset.
pub fn with_input(self, input: Input) -> Transaction
[src]
pub fn with_input(self, input: Input) -> Transaction
Builds a new transaction with the provided inputs added. Existing inputs, if any, are kept intact. Sort order is maintained.
pub fn with_output(self, output: Output) -> Transaction
[src]
pub fn with_output(self, output: Output) -> Transaction
Builds a new transaction with the provided output added. Existing outputs, if any, are kept intact. Sort order is maintained.
pub fn with_kernel(self, kernel: TxKernel) -> Transaction
[src]
pub fn with_kernel(self, kernel: TxKernel) -> Transaction
Builds a new transaction with the provided output added. Existing outputs, if any, are kept intact. Sort order is maintained.
pub fn inputs(&self) -> &Vec<Input>
[src]
pub fn inputs(&self) -> &Vec<Input>
Get inputs
pub fn inputs_mut(&mut self) -> &mut Vec<Input>
[src]
pub fn inputs_mut(&mut self) -> &mut Vec<Input>
Get inputs mutable
pub fn outputs(&self) -> &Vec<Output>
[src]
pub fn outputs(&self) -> &Vec<Output>
Get outputs
pub fn outputs_mut(&mut self) -> &mut Vec<Output>
[src]
pub fn outputs_mut(&mut self) -> &mut Vec<Output>
Get outputs mutable
pub fn kernels(&self) -> &Vec<TxKernel>
[src]
pub fn kernels(&self) -> &Vec<TxKernel>
Get kernels
pub fn kernels_mut(&mut self) -> &mut Vec<TxKernel>
[src]
pub fn kernels_mut(&mut self) -> &mut Vec<TxKernel>
Get kernels mut
pub fn fee(&self) -> u64
[src]
pub fn fee(&self) -> u64
Total fee for a transaction is the sum of fees of all kernels.
pub fn overage(&self) -> i64
[src]
pub fn overage(&self) -> i64
Total overage across all kernels.
pub fn lock_height(&self) -> u64
[src]
pub fn lock_height(&self) -> u64
Lock height of a transaction is the max lock height of the kernels.
pub fn validate_read(&self) -> Result<(), Error>
[src]
pub fn validate_read(&self) -> Result<(), Error>
"Lightweight" validation that we can perform quickly during read/deserialization. Subset of full validation that skips expensive verification steps, specifically -
- rangeproof verification (on the body)
- kernel signature verification (on the body)
- kernel sum verification
pub fn validate(
&self,
verifier: Arc<RwLock<dyn VerifierCache>>
) -> Result<(), Error>
[src]
pub fn validate(
&self,
verifier: Arc<RwLock<dyn VerifierCache>>
) -> Result<(), Error>
Validates all relevant parts of a fully built transaction. Checks the excess value against the signature as well as range proofs for each output.
pub fn tx_weight(&self) -> usize
[src]
pub fn tx_weight(&self) -> usize
Calculate transaction weight
pub fn tx_weight_as_block(&self) -> usize
[src]
pub fn tx_weight_as_block(&self) -> usize
Calculate transaction weight as a block
pub fn weight(input_len: usize, output_len: usize, kernel_len: usize) -> usize
[src]
pub fn weight(input_len: usize, output_len: usize, kernel_len: usize) -> usize
Calculate transaction weight from transaction details
Trait Implementations
impl Committed for Transaction
[src]
impl Committed for Transaction
fn inputs_committed(&self) -> Vec<Commitment>
[src]
fn inputs_committed(&self) -> Vec<Commitment>
fn outputs_committed(&self) -> Vec<Commitment>
[src]
fn outputs_committed(&self) -> Vec<Commitment>
fn kernels_committed(&self) -> Vec<Commitment>
[src]
fn kernels_committed(&self) -> Vec<Commitment>
fn sum_kernel_excesses(
&self,
offset: &BlindingFactor
) -> Result<(Commitment, Commitment), Error>
[src]
fn sum_kernel_excesses(
&self,
offset: &BlindingFactor
) -> Result<(Commitment, Commitment), Error>
Gather the kernel excesses and sum them.
fn sum_commitments(&self, overage: i64) -> Result<Commitment, Error>
[src]
fn sum_commitments(&self, overage: i64) -> Result<Commitment, Error>
Gathers commitments and sum them.
fn verify_kernel_sums(
&self,
overage: i64,
kernel_offset: BlindingFactor
) -> Result<(Commitment, Commitment), Error>
[src]
fn verify_kernel_sums(
&self,
overage: i64,
kernel_offset: BlindingFactor
) -> Result<(Commitment, Commitment), Error>
Verify the sum of the kernel excesses equals the sum of the outputs, taking into account both the kernel_offset and overage. Read more
impl Writeable for Transaction
[src]
impl Writeable for Transaction
Implementation of Writeable for a fully blinded transaction, defines how to write the transaction as binary.
impl Readable for Transaction
[src]
impl Readable for Transaction
Implementation of Readable for a transaction, defines how to read a full transaction from a binary stream.
impl PartialEq<Transaction> for Transaction
[src]
impl PartialEq<Transaction> for Transaction
PartialEq
fn eq(&self, tx: &Transaction) -> bool
[src]
fn eq(&self, tx: &Transaction) -> bool
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl Clone for Transaction
[src]
impl Clone for Transaction
fn clone(&self) -> Transaction
[src]
fn clone(&self) -> Transaction
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Into<TransactionBody> for Transaction
[src]
impl Into<TransactionBody> for Transaction
fn into(self) -> TransactionBody
[src]
fn into(self) -> TransactionBody
impl Default for Transaction
[src]
impl Default for Transaction
fn default() -> Transaction
[src]
fn default() -> Transaction
impl Debug for Transaction
[src]
impl Debug for Transaction
impl Serialize for Transaction
[src]
impl Serialize for Transaction
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
impl<'de> Deserialize<'de> for Transaction
[src]
impl<'de> Deserialize<'de> for Transaction
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Auto Trait Implementations
impl Send for Transaction
impl Send for Transaction
impl Sync for Transaction
impl Sync for Transaction
Blanket Implementations
impl<W> Hashed for W where
W: Writeable,
[src]
impl<W> Hashed for W where
W: Writeable,
impl<H> ShortIdentifiable for H where
H: Hashed,
[src]
impl<H> ShortIdentifiable for H where
H: Hashed,
fn short_id(&Self, &Hash, u64) -> ShortId
[src]
fn short_id(&Self, &Hash, 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)
impl<T> PMMRIndexHashable for T where
T: Writeable,
[src]
impl<T> PMMRIndexHashable for T where
T: Writeable,
fn hash_with_index(&Self, u64) -> Hash
[src]
fn hash_with_index(&Self, u64) -> Hash
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
impl<T> DebugAny for T where
T: Any + Debug,
impl<T> DebugAny for T where
T: Any + Debug,
impl<T> CloneAny for T where
T: Clone + Any,
impl<T> CloneAny for T where
T: Clone + Any,
fn clone_any(&self) -> Box<dyn CloneAny + 'static>
fn clone_any(&self) -> Box<dyn CloneAny + 'static>
fn clone_any_send(&self) -> Box<dyn CloneAny + 'static + Send> where
T: Send,
fn clone_any_send(&self) -> Box<dyn CloneAny + 'static + Send> where
T: Send,
fn clone_any_sync(&self) -> Box<dyn CloneAny + 'static + Sync> where
T: Sync,
fn clone_any_sync(&self) -> Box<dyn CloneAny + 'static + Sync> where
T: Sync,
fn clone_any_send_sync(&self) -> Box<dyn CloneAny + 'static + Sync + Send> where
T: Send + Sync,
fn clone_any_send_sync(&self) -> Box<dyn CloneAny + 'static + Sync + Send> where
T: Send + Sync,
impl<T> UnsafeAny for T where
T: Any,
impl<T> UnsafeAny for T where
T: Any,
impl<T> Erased for T
impl<T> Erased for T
impl<T> Same for T
impl<T> Same for T
type Output = T
Should always be Self