diff --git a/Cargo.toml b/Cargo.toml index b4cae82..123a84c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,14 +6,19 @@ rust-version = "1.67.0" description = "An upcoming experimental, modern & secure monero node" readme = "readme.md" repository = "https://github.com/SyntheticBird45/cuprate" -license = "BSD-3-Clause" +license = "GPL-3" license-file = "LICENSE" # All Contributors on github -authors=["SyntheticBird45"] +authors=[ + "SyntheticBird45 <@someoneelse495495:matrix.org>" + ] +[workspace] -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +members = [ + "blockchain_db" +] [dependencies] monero = {version = "*", features = ['serde']} diff --git a/blockchain_db/Cargo.toml b/blockchain_db/Cargo.toml new file mode 100644 index 0000000..d098d3e --- /dev/null +++ b/blockchain_db/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "blockchain_db" +version = "0.0.1" +edition = "2021" +rust-version = "1.67.0" + +# All Contributors on github +authors=[ + "SyntheticBird45 <@someoneelse495495:matrix.org>" + ] + + +[dependencies] +monero = {version = "*", features = ['serde']} +serde = "*" + +# As suggested by /u/danda : +thiserror = "*" \ No newline at end of file diff --git a/src/blockchain_db/mod.rs b/blockchain_db/src/lib.rs similarity index 97% rename from src/blockchain_db/mod.rs rename to blockchain_db/src/lib.rs index d606356..9b9c4f9 100644 --- a/src/blockchain_db/mod.rs +++ b/blockchain_db/src/lib.rs @@ -1,16 +1,26 @@ use thiserror::Error; use monero::{Hash, Transaction, Block, BlockHeader}; -use crate::{cryptonote_protocol::enums::{RelayMethod}, cryptonote_basic::difficulty::difficulty_type, blockchain_db::{}}; use std::{error::Error, ops::Range}; const MONERO_DEFAULT_LOG_CATEGORY: &str = "blockchain.db"; +pub type difficulty_type = u128; type Blobdata = Vec; type TxOutIndex = (Hash, u64); +/// Methods tracking how a tx was received and relayed +pub enum RelayMethod { + none, //< Received via RPC with `do_not_relay` set + local, //< Received via RPC; trying to send over i2p/tor, etc. + forward, //< Received over i2p/tor; timer delayed before ipv4/6 public broadcast + stem, //< Received/send over network using Dandelion++ stem + fluff, //< Received/sent over network using Dandelion++ fluff + block, //< Received in block, takes precedence over others +} + // the database types are going to be defined in the monero rust library. -pub(in super) enum RelayCategory { +pub enum RelayCategory { broadcasted, //< Public txes received via block/fluff relayable, //< Every tx not marked `relay_method::none` legacy, //< `relay_category::broadcasted` + `relay_method::none` for rpc relay requests or historical reasons @@ -96,7 +106,7 @@ pub enum TESTTT { #[allow(dead_code)] #[derive(Error, Debug)] -pub(in super) enum DB_FAILURES { +pub enum DB_FAILURES { #[error("DB_ERROR: `{0}`. The database is likely corrupted.")] DB_ERROR(String), #[error("DB_ERROR_TXN_START: `{0}`. The database failed starting a txn.")] @@ -132,7 +142,7 @@ pub(in super) enum DB_FAILURES { HASH_DNE(Option), } -pub(in super) trait BlockchainDB { +pub trait BlockchainDB { // supposed to be private diff --git a/src/blocks/main.rs b/src/blocks/mod.rs similarity index 100% rename from src/blocks/main.rs rename to src/blocks/mod.rs diff --git a/src/cryptonote_basic/difficulty.rs b/src/cryptonote_basic/difficulty.rs index 4da29ff..e69de29 100644 --- a/src/cryptonote_basic/difficulty.rs +++ b/src/cryptonote_basic/difficulty.rs @@ -1 +0,0 @@ -pub type difficulty_type = u128; \ No newline at end of file diff --git a/src/cryptonote_protocol/enums.rs b/src/cryptonote_protocol/enums.rs index 3826eac..e69de29 100644 --- a/src/cryptonote_protocol/enums.rs +++ b/src/cryptonote_protocol/enums.rs @@ -1,9 +0,0 @@ -/// Methods tracking how a tx was received and relayed -pub enum RelayMethod { - none, //< Received via RPC with `do_not_relay` set - local, //< Received via RPC; trying to send over i2p/tor, etc. - forward, //< Received over i2p/tor; timer delayed before ipv4/6 public broadcast - stem, //< Received/send over network using Dandelion++ stem - fluff, //< Received/sent over network using Dandelion++ fluff - block, //< Received in block, takes precedence over others -} \ No newline at end of file