Return Timelocked instead of (Timelock, Vec<SpendableOutput>)

Timelocked doesn't expose the Vec yet requires calling not_locked(), 
unlocked(Timelock), or ignore_timelock().
This commit is contained in:
Luke Parker
2022-07-09 18:53:52 -04:00
parent a4cd1755a5
commit 53267a46c8
5 changed files with 48 additions and 15 deletions

View File

@@ -1,3 +1,5 @@
use core::cmp::Ordering;
use curve25519_dalek::edwards::EdwardsPoint;
use crate::{hash, serialize::*, ringct::{RctPrunable, RctSignatures}};
@@ -131,6 +133,17 @@ impl Timelock {
}
}
impl PartialOrd for Timelock {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
match (self, other) {
(Timelock::None, _) => Some(Ordering::Less),
(Timelock::Block(a), Timelock::Block(b)) => a.partial_cmp(b),
(Timelock::Time(a), Timelock::Time(b)) => a.partial_cmp(b),
_ => None
}
}
}
#[derive(Clone, PartialEq, Debug)]
pub struct TransactionPrefix {
pub version: u64,