fix tx timelock

This commit is contained in:
hinto.janai 2024-09-30 16:21:02 -04:00
parent 7660532840
commit cc078b693b
No known key found for this signature in database
GPG key ID: D47CE05FA175A499
2 changed files with 8 additions and 12 deletions

View file

@ -117,12 +117,10 @@ impl TryFrom<transaction::Transaction> for MinerTransaction {
.collect();
let unlock_time = match prefix.additional_timelock {
transaction::Timelock::None => height,
transaction::Timelock::Block(height_lock) => height + usize_to_u64(height_lock),
transaction::Timelock::Time(seconds) => {
height + (seconds / usize_to_u64(monero_serai::BLOCK_TIME))
}
} + usize_to_u64(monero_serai::DEFAULT_LOCK_WINDOW);
transaction::Timelock::None => 0,
transaction::Timelock::Block(x) => usize_to_u64(x),
transaction::Timelock::Time(x) => x,
};
Ok(MinerTransactionPrefix {
version,

View file

@ -106,12 +106,10 @@ impl From<transaction::Transaction> for Transaction {
.collect();
let unlock_time = match prefix.additional_timelock {
transaction::Timelock::None => height,
transaction::Timelock::Block(height_lock) => height + usize_to_u64(height_lock),
transaction::Timelock::Time(seconds) => {
height + (seconds / usize_to_u64(monero_serai::BLOCK_TIME))
}
} + usize_to_u64(monero_serai::DEFAULT_LOCK_WINDOW);
transaction::Timelock::None => 0,
transaction::Timelock::Block(x) => usize_to_u64(x),
transaction::Timelock::Time(x) => x,
};
TransactionPrefix {
version,