mirror of
https://github.com/hinto-janai/cuprate.git
synced 2025-01-11 05:15:20 +00:00
features
This commit is contained in:
parent
4f87767063
commit
374bc77cfb
8 changed files with 39 additions and 11 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -603,6 +603,7 @@ dependencies = [
|
|||
name = "cuprate-constants"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"hex",
|
||||
"hex-literal",
|
||||
"monero-serai",
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
use monero_serai::transaction::{Input, Output, Timelock, Transaction};
|
||||
|
||||
use cuprate_constants::block::MAX_BLOCK_HEIGHT;
|
||||
use cuprate_helper::cast::u64_to_usize;
|
||||
use cuprate_constants::block::MAX_BLOCK_HEIGHT_USIZE;
|
||||
use cuprate_types::TxVersion;
|
||||
|
||||
use crate::{is_decomposed_amount, transactions::check_output_types, HardFork};
|
||||
|
@ -114,7 +113,7 @@ fn check_time_lock(time_lock: &Timelock, chain_height: usize) -> Result<(), Mine
|
|||
&Timelock::Block(till_height) => {
|
||||
// Lock times above this amount are timestamps not blocks.
|
||||
// This is just for safety though and shouldn't actually be hit.
|
||||
if till_height > u64_to_usize(MAX_BLOCK_HEIGHT) {
|
||||
if till_height > MAX_BLOCK_HEIGHT_USIZE {
|
||||
Err(MinerTxError::InvalidLockTime)?;
|
||||
}
|
||||
if till_height != chain_height + MINER_TX_TIME_LOCKED_BLOCKS {
|
||||
|
|
|
@ -9,13 +9,17 @@ repository = "https://github.com/Cuprate/cuprate/tree/main/constants"
|
|||
keywords = ["cuprate", "constants"]
|
||||
|
||||
[features]
|
||||
default = ["monero-serai"]
|
||||
monero-serai = ["dep:monero-serai"]
|
||||
default = []
|
||||
block = []
|
||||
build = []
|
||||
genesis = ["dep:monero-serai", "dep:hex-literal", "dep:paste"]
|
||||
rpc = []
|
||||
|
||||
[dependencies]
|
||||
cfg-if = { workspace = true }
|
||||
monero-serai = { workspace = true, optional = true }
|
||||
hex-literal = { workspace = true }
|
||||
paste = { workspace = true }
|
||||
hex-literal = { workspace = true, optional = true }
|
||||
paste = { workspace = true, optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
monero-serai = { workspace = true }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# cuprate-constants
|
||||
This crate contains general constants that are not specific to any particular
|
||||
part of the codebase yet are used in multiple places such as the [`crate::block::MAX_BLOCK_HEIGHT`].
|
||||
part of the codebase yet are used in multiple places such as the maximum block height.
|
||||
|
||||
## Static data
|
||||
This crate also contains `static` data used in multiple places such as the [`crate::genesis::mainnet::GENESIS_BLOCK`].
|
||||
This crate also contains `static` data used in multiple places such as the genesis block.
|
|
@ -1,9 +1,22 @@
|
|||
#![doc = include_str!("../README.md")]
|
||||
#![deny(missing_docs, reason = "all constants should document what they are")]
|
||||
|
||||
cfg_if::cfg_if! {
|
||||
// Used in test modules.
|
||||
if #[cfg(test)] {
|
||||
use hex as _;
|
||||
use monero_serai as _;
|
||||
use pretty_assertions as _;
|
||||
}
|
||||
}
|
||||
|
||||
mod macros;
|
||||
|
||||
#[cfg(feature = "block")]
|
||||
pub mod block;
|
||||
#[cfg(feature = "build")]
|
||||
pub mod build;
|
||||
#[cfg(feature = "genesis")]
|
||||
pub mod genesis;
|
||||
#[cfg(feature = "rpc")]
|
||||
pub mod rpc;
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
/// Output a string link to `monerod` source code.
|
||||
#[allow(
|
||||
clippy::allow_attributes,
|
||||
unused_macros,
|
||||
reason = "used in feature gated modules"
|
||||
)]
|
||||
macro_rules! monero_definition_link {
|
||||
(
|
||||
$commit:ident, // Git commit hash
|
||||
|
@ -21,4 +26,10 @@ macro_rules! monero_definition_link {
|
|||
)
|
||||
};
|
||||
}
|
||||
|
||||
#[allow(
|
||||
clippy::allow_attributes,
|
||||
unused_imports,
|
||||
reason = "used in feature gated modules"
|
||||
)]
|
||||
pub(crate) use monero_definition_link;
|
||||
|
|
|
@ -24,7 +24,7 @@ thread = ["std", "dep:target_os_lib"]
|
|||
tx = ["dep:monero-serai"]
|
||||
|
||||
[dependencies]
|
||||
cuprate-constants = { path = "../constants", optional = true }
|
||||
cuprate-constants = { path = "../constants", optional = true, features = ["block"] }
|
||||
|
||||
crossbeam = { workspace = true, optional = true }
|
||||
chrono = { workspace = true, optional = true, features = ["std", "clock"] }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//! Contains [`BlockCompleteEntry`] and the related types.
|
||||
|
||||
//---------------------------------------------------------------------------------------------------- Import
|
||||
// #[cfg(feature = "epee")]
|
||||
#[cfg(feature = "epee")]
|
||||
use bytes::Bytes;
|
||||
|
||||
#[cfg(feature = "serde")]
|
||||
|
|
Loading…
Reference in a new issue