drop Ord on absolute::LockTime; add Ord to Transaction
This commit is contained in:
parent
5b7d801ee6
commit
821842e1a1
|
@ -62,7 +62,6 @@ pub const LOCK_TIME_THRESHOLD: u32 = 500_000_000;
|
||||||
/// ```
|
/// ```
|
||||||
#[allow(clippy::derive_ord_xor_partial_ord)]
|
#[allow(clippy::derive_ord_xor_partial_ord)]
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
#[derive(Ord)] // will be removed in next commit
|
|
||||||
pub enum LockTime {
|
pub enum LockTime {
|
||||||
/// A block height lock time value.
|
/// A block height lock time value.
|
||||||
///
|
///
|
||||||
|
|
|
@ -16,7 +16,7 @@ use crate::prelude::*;
|
||||||
|
|
||||||
use crate::io;
|
use crate::io;
|
||||||
use crate::string::FromHexStr;
|
use crate::string::FromHexStr;
|
||||||
use core::{fmt, str, default::Default};
|
use core::{cmp, fmt, str, default::Default};
|
||||||
use core::convert::TryFrom;
|
use core::convert::TryFrom;
|
||||||
|
|
||||||
use bitcoin_internals::write_err;
|
use bitcoin_internals::write_err;
|
||||||
|
@ -580,7 +580,7 @@ impl<E> EncodeSigningDataResult<E> {
|
||||||
///
|
///
|
||||||
/// We therefore deviate from the spec by always using the Segwit witness encoding
|
/// We therefore deviate from the spec by always using the Segwit witness encoding
|
||||||
/// for 0-input transactions, which results in unambiguously parseable transactions.
|
/// for 0-input transactions, which results in unambiguously parseable transactions.
|
||||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
|
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
|
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
|
||||||
pub struct Transaction {
|
pub struct Transaction {
|
||||||
|
@ -599,6 +599,20 @@ pub struct Transaction {
|
||||||
pub output: Vec<TxOut>,
|
pub output: Vec<TxOut>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl cmp::PartialOrd for Transaction {
|
||||||
|
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
|
||||||
|
Some(self.cmp(&other))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl cmp::Ord for Transaction {
|
||||||
|
fn cmp(&self, other: &Self) -> cmp::Ordering {
|
||||||
|
self.version.cmp(&other.version)
|
||||||
|
.then(self.lock_time.to_consensus_u32().cmp(&other.lock_time.to_consensus_u32()))
|
||||||
|
.then(self.input.cmp(&other.input))
|
||||||
|
.then(self.output.cmp(&other.output))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Transaction {
|
impl Transaction {
|
||||||
/// Computes a "normalized TXID" which does not include any signatures.
|
/// Computes a "normalized TXID" which does not include any signatures.
|
||||||
///
|
///
|
||||||
|
|
Loading…
Reference in New Issue