[][src]Function grin_core::core::transaction::cut_through

pub fn cut_through<'a, 'b, T, U>(
    inputs: &'a mut [T],
    outputs: &'b mut [U]
) -> Result<(&'a [T], &'b [U], &'a [T], &'b [U]), Error> where
    T: AsRef<Commitment> + Ord,
    U: AsRef<Commitment> + Ord

Takes a slice of inputs and a slice of outputs and applies "cut-through" eliminating any input/output pairs with input spending output. Returns new slices with cut-through elements removed. Also returns slices of the cut-through elements themselves. Note: Takes slices of anything that is AsRef for greater flexibility. So we can cut_through inputs and outputs but we can also cut_through inputs and output identifiers. Or we can get crazy and cut_through inputs with other inputs to identify intersection and difference etc.

Example: Inputs: [A, B, C] Outputs: [C, D, E] Returns: ([A, B], [D, E], [C], [C]) # element C is cut-through