[−][src]Struct grin_core::core::transaction::TransactionBody
TransactionBody is a common abstraction for transaction and block
Fields
inputs: Vec<Input>
List of inputs spent by the transaction.
outputs: Vec<Output>
List of outputs the transaction produces.
kernels: Vec<TxKernel>
List of kernels that make up this transaction (usually a single kernel).
Methods
impl TransactionBody
[src]
pub fn empty() -> TransactionBody
[src]
Creates a new empty transaction (no inputs or outputs, zero fee).
pub fn sort(&mut self)
[src]
Sort the inputs|outputs|kernels.
pub fn init(
inputs: Vec<Input>,
outputs: Vec<Output>,
kernels: Vec<TxKernel>,
verify_sorted: bool
) -> Result<TransactionBody, Error>
[src]
inputs: Vec<Input>,
outputs: Vec<Output>,
kernels: Vec<TxKernel>,
verify_sorted: bool
) -> Result<TransactionBody, Error>
Creates a new transaction body initialized with the provided inputs, outputs and kernels. Guarantees inputs, outputs, kernels are sorted lexicographically.
pub fn with_input(self, input: Input) -> TransactionBody
[src]
Builds a new body with the provided inputs added. Existing inputs, if any, are kept intact. Sort order is maintained.
pub fn with_output(self, output: Output) -> TransactionBody
[src]
Builds a new TransactionBody with the provided output added. Existing outputs, if any, are kept intact. Sort order is maintained.
pub fn with_kernel(self, kernel: TxKernel) -> TransactionBody
[src]
Builds a new TransactionBody with the provided kernel added. Existing kernels, if any, are kept intact. Sort order is maintained.
pub fn body_weight(&self) -> usize
[src]
Calculate transaction weight
pub fn body_weight_as_block(&self) -> usize
[src]
Calculate weight of transaction using block weighing
pub fn weight(input_len: usize, output_len: usize, kernel_len: usize) -> usize
[src]
Calculate transaction weight from transaction details. This is non consensus critical and compared to block weight, incentivizes spending more outputs (to lower the fee).
pub fn weight_as_block(
input_len: usize,
output_len: usize,
kernel_len: usize
) -> usize
[src]
input_len: usize,
output_len: usize,
kernel_len: usize
) -> usize
Calculate transaction weight using block weighing from transaction details. Consensus critical and uses consensus weight values.
pub fn lock_height(&self) -> u64
[src]
Lock height of a body is the max lock height of the kernels.
pub fn verify_features(&self) -> Result<(), Error>
[src]
Verify we have no invalid outputs or kernels in the transaction due to invalid features. Specifically, a transaction cannot contain a coinbase output or a coinbase kernel.
pub fn validate_read(&self, weighting: Weighting) -> 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
- kernel signature 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 transaction body. Checks the excess value against the signature as well as range proofs for each output.
Trait Implementations
impl Committed for TransactionBody
[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 Writeable for TransactionBody
[src]
Implementation of Writeable for a body, defines how to write the body as binary.
impl Readable for TransactionBody
[src]
Implementation of Readable for a body, defines how to read a body from a binary stream.
impl PartialEq<TransactionBody> for TransactionBody
[src]
PartialEq
fn eq(&self, l: &TransactionBody) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl Default for TransactionBody
[src]
fn default() -> TransactionBody
[src]
impl Into<TransactionBody> for Transaction
[src]
fn into(self) -> TransactionBody
[src]
impl Clone for TransactionBody
[src]
fn clone(&self) -> TransactionBody
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for TransactionBody
[src]
impl Serialize for TransactionBody
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'de> Deserialize<'de> for TransactionBody
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
Auto Trait Implementations
impl Send for TransactionBody
impl Unpin for TransactionBody
impl Sync for TransactionBody
impl UnwindSafe for TransactionBody
impl RefUnwindSafe for TransactionBody
Blanket Implementations
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