Skip to content

Commit

Permalink
Change kernel ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
SWvheerden authored and sdbondi committed Sep 21, 2021
1 parent ac5f26e commit d456aef
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion base_layer/core/src/transactions/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ impl From<CryptoFullRewindResult<BlindingFactor>> for FullRewindResult {
/// [Mimblewimble TLU post](https://tlu.tarilabs.com/protocols/mimblewimble-1/sources/PITCHME.link.html?highlight=mimblewimble#mimblewimble).
/// The kernel also tracks other transaction metadata, such as the lock height for the transaction (i.e. the earliest
/// this transaction can be mined) and the transaction fee, in cleartext.
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct TransactionKernel {
/// Options for a kernel's structure or use
pub features: KernelFeatures,
Expand Down Expand Up @@ -1072,6 +1072,18 @@ impl Display for TransactionKernel {
}
}

impl PartialOrd for TransactionKernel {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
self.excess_sig.partial_cmp(&other.excess_sig)
}
}

impl Ord for TransactionKernel {
fn cmp(&self, other: &Self) -> Ordering {
self.excess_sig.cmp(&other.excess_sig)
}
}

/// This struct holds the result of calculating the sum of the kernels in a Transaction
/// and returns the summed commitments and the total fees
#[derive(Default)]
Expand Down

0 comments on commit d456aef

Please sign in to comment.