mirror of
https://github.com/hinto-janai/cuprate.git
synced 2025-01-08 20:09:41 +00:00
cleanup
This commit is contained in:
parent
a5316ad331
commit
7902f0a902
5 changed files with 10 additions and 21 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -885,7 +885,6 @@ dependencies = [
|
|||
name = "cuprate-types"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"bytes",
|
||||
"cuprate-epee-encoding",
|
||||
"cuprate-fixed-bytes",
|
||||
|
|
|
@ -13,9 +13,8 @@ default = ["blockchain", "epee", "serde", "json", "hex"]
|
|||
blockchain = []
|
||||
epee = ["dep:cuprate-epee-encoding"]
|
||||
serde = ["dep:serde"]
|
||||
bytemuck = ["dep:bytemuck"]
|
||||
proptest = ["dep:proptest", "dep:proptest-derive"]
|
||||
json = ["hex", "bytemuck", "dep:cuprate-helper"]
|
||||
json = ["hex", "dep:cuprate-helper"]
|
||||
hex = ["dep:hex", "dep:paste"]
|
||||
|
||||
[dependencies]
|
||||
|
@ -23,7 +22,6 @@ cuprate-epee-encoding = { path = "../net/epee-encoding", optional = true }
|
|||
cuprate-helper = { path = "../helper", optional = true, features = ["cast"] }
|
||||
cuprate-fixed-bytes = { path = "../net/fixed-bytes" }
|
||||
|
||||
bytemuck = { workspace = true, features = ["derive"], optional = true }
|
||||
bytes = { workspace = true }
|
||||
curve25519-dalek = { workspace = true }
|
||||
monero-serai = { workspace = true }
|
||||
|
|
|
@ -3,16 +3,6 @@
|
|||
//! This module provides transparent wrapper types for
|
||||
//! arrays that (de)serialize from hexadecimal input/output.
|
||||
|
||||
#![cfg_attr(
|
||||
feature = "bytemuck",
|
||||
expect(
|
||||
clippy::allow_attributes,
|
||||
reason = "bytemuck uses allow in its derive macros"
|
||||
)
|
||||
)]
|
||||
|
||||
#[cfg(feature = "bytemuck")]
|
||||
use bytemuck::{Pod, TransparentWrapper, Zeroable};
|
||||
#[cfg(feature = "epee")]
|
||||
use cuprate_epee_encoding::{error, macros::bytes, EpeeValue, Marker};
|
||||
#[cfg(feature = "serde")]
|
||||
|
@ -29,7 +19,6 @@ macro_rules! generate_hex_array {
|
|||
$(
|
||||
#[doc = concat!("Wrapper type that (de)serializes from/to a ", stringify!($array_len), "-byte array.")]
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
#[cfg_attr(feature = "bytemuck", derive(Pod, Zeroable, TransparentWrapper))]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
#[cfg_attr(feature = "serde", serde(transparent))]
|
||||
#[repr(transparent)]
|
||||
|
|
|
@ -116,12 +116,13 @@ impl TryFrom<transaction::Transaction> for MinerTransaction {
|
|||
})
|
||||
.collect();
|
||||
|
||||
// TODO: use cuprate_constants target time
|
||||
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 * 120),
|
||||
} + 60;
|
||||
transaction::Timelock::Time(seconds) => {
|
||||
height + (seconds / usize_to_u64(monero_serai::BLOCK_TIME))
|
||||
}
|
||||
} + usize_to_u64(monero_serai::DEFAULT_LOCK_WINDOW);
|
||||
|
||||
Ok(MinerTransactionPrefix {
|
||||
version,
|
||||
|
|
|
@ -105,12 +105,13 @@ impl From<transaction::Transaction> for Transaction {
|
|||
})
|
||||
.collect();
|
||||
|
||||
// TODO: use cuprate_constants target time
|
||||
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 * 120),
|
||||
} + 60;
|
||||
transaction::Timelock::Time(seconds) => {
|
||||
height + (seconds / usize_to_u64(monero_serai::BLOCK_TIME))
|
||||
}
|
||||
} + usize_to_u64(monero_serai::DEFAULT_LOCK_WINDOW);
|
||||
|
||||
TransactionPrefix {
|
||||
version,
|
||||
|
@ -121,6 +122,7 @@ impl From<transaction::Transaction> for Transaction {
|
|||
}
|
||||
}
|
||||
|
||||
#[expect(unreachable_code, unused_variables, reason = "TODO: finish impl")]
|
||||
match tx {
|
||||
transaction::Transaction::V1 { prefix, signatures } => Self::V1 {
|
||||
prefix: map_prefix(prefix, 1),
|
||||
|
|
Loading…
Reference in a new issue