[−][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
body: TransactionBody
The transaction body - inputs/outputs/kernels
Methods
impl Transaction
[src]
pub fn empty() -> Transaction
[src]
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]
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]
Creates a new transaction using this transaction as a template and with the specified offset.
pub fn with_input(self, input: Input) -> Transaction
[src]
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]
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]
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]
Get inputs
pub fn inputs_mut(&mut self) -> &mut Vec<Input>
[src]
Get inputs mutable
pub fn outputs(&self) -> &Vec<Output>
[src]
Get outputs
pub fn outputs_mut(&mut self) -> &mut Vec<Output>
[src]
Get outputs mutable
pub fn kernels(&self) -> &Vec<TxKernel>
[src]
Get kernels
pub fn kernels_mut(&mut self) -> &mut Vec<TxKernel>
[src]
Get kernels mut
pub fn fee(&self) -> u64
[src]
Total fee for a transaction is the sum of fees of all kernels.
pub fn overage(&self) -> i64
[src]
Total overage across all kernels.
pub fn lock_height(&self) -> u64
[src]
Lock height of a transaction is the max lock height of the kernels.
pub fn validate_read(&self) -> Result<(), Error>
[src]
"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,
weighting: Weighting,
verifier: Arc<RwLock<dyn VerifierCache>>
) -> Result<(), Error>
[src]
&self,
weighting: Weighting,
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 fee_to_weight(&self) -> u64
[src]
Can be used to compare txs by their fee/weight ratio. Don't use these values for anything else though due to precision multiplier.
pub fn tx_weight(&self) -> usize
[src]
Calculate transaction weight
pub fn tx_weight_as_block(&self) -> usize
[src]
Calculate transaction weight as a block
pub fn weight(input_len: usize, output_len: usize, kernel_len: usize) -> usize
[src]
Calculate transaction weight from transaction details
Trait Implementations
impl Committed for Transaction
[src]
fn inputs_committed(&self) -> Vec<Commitment>
[src]
fn outputs_committed(&self) -> Vec<Commitment>
[src]
fn kernels_committed(&self) -> Vec<Commitment>
[src]
fn sum_kernel_excesses(
&self,
offset: &BlindingFactor
) -> Result<(Commitment, Commitment), Error>
[src]
&self,
offset: &BlindingFactor
) -> Result<(Commitment, Commitment), Error>
Gather the kernel excesses and sum them.
fn sum_commitments(&self, overage: i64) -> Result<Commitment, Error>
[src]
Gathers commitments and sum them.
fn verify_kernel_sums(
&self,
overage: i64,
kernel_offset: BlindingFactor
) -> Result<(Commitment, Commitment), Error>
[src]
&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 DefaultHashable for Transaction
[src]
impl Writeable for Transaction
[src]
Implementation of Writeable for a fully blinded transaction, defines how to write the transaction as binary.
impl Readable for Transaction
[src]
Implementation of Readable for a transaction, defines how to read a full transaction from a binary stream.
impl PartialEq<Transaction> for Transaction
[src]
PartialEq
fn eq(&self, tx: &Transaction) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl Default for Transaction
[src]
fn default() -> Transaction
[src]
impl Into<TransactionBody> for Transaction
[src]
fn into(self) -> TransactionBody
[src]
impl Clone for Transaction
[src]
fn clone(&self) -> Transaction
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Transaction
[src]
impl Serialize for Transaction
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'de> Deserialize<'de> for Transaction
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
Auto Trait Implementations
impl Send for Transaction
impl Unpin for Transaction
impl Sync for Transaction
impl UnwindSafe for Transaction
impl RefUnwindSafe for Transaction
Blanket Implementations
impl<D> Hashed for D where
D: DefaultHashable,
[src]
D: DefaultHashable,
impl<H> ShortIdentifiable for H where
H: Hashed,
[src]
H: Hashed,
fn short_id(&Self, &Hash, u64) -> ShortId
[src]
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: DefaultHashable,
[src]
T: DefaultHashable,
fn hash_with_index(&Self, u64) -> Hash
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> DebugAny for T where
T: Any + Debug,
T: Any + Debug,
impl<T> CloneAny for T where
T: Clone + Any,
T: Clone + Any,
fn clone_any(&self) -> Box<dyn CloneAny + 'static>
fn clone_any_send(&self) -> Box<dyn CloneAny + 'static + Send> where
T: Send,
T: Send,
fn clone_any_sync(&self) -> Box<dyn CloneAny + 'static + Sync> where
T: Sync,
T: Sync,
fn clone_any_send_sync(&self) -> Box<dyn CloneAny + 'static + Sync + Send> where
T: Send + Sync,
T: Send + Sync,
impl<T> UnsafeAny for T where
T: Any,
T: Any,
impl<T> Same<T> for T
type Output = T
Should always be Self