mirror of
https://github.com/Cuprate/cuprate.git
synced 2024-12-23 12:09:52 +00:00
init cuprated
This commit is contained in:
parent
c50d9642be
commit
317b6a79dd
8 changed files with 80 additions and 3 deletions
16
Cargo.lock
generated
16
Cargo.lock
generated
|
@ -643,6 +643,20 @@ dependencies = [
|
|||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cuprated"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"cuprate-blockchain",
|
||||
"cuprate-consensus",
|
||||
"cuprate-p2p",
|
||||
"dandelion-tower",
|
||||
"futures",
|
||||
"monero-p2p",
|
||||
"tokio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "curve25519-dalek"
|
||||
version = "4.1.2"
|
||||
|
@ -690,7 +704,7 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "dandelion_tower"
|
||||
name = "dandelion-tower"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"futures",
|
||||
|
|
|
@ -19,7 +19,7 @@ members = [
|
|||
"storage/database",
|
||||
"pruning",
|
||||
"test-utils",
|
||||
"types",
|
||||
"types", "binaries/cuprated",
|
||||
]
|
||||
|
||||
[profile.release]
|
||||
|
|
26
binaries/cuprated/Cargo.toml
Normal file
26
binaries/cuprated/Cargo.toml
Normal file
|
@ -0,0 +1,26 @@
|
|||
[package]
|
||||
name = "cuprated"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
license = "AGPL-3-only"
|
||||
authors = ["Boog900", "hinto-janai", "SyntheticBird45"]
|
||||
|
||||
[dependencies]
|
||||
# P2P
|
||||
cuprate-p2p = { path = "../../p2p/cuprate-p2p" }
|
||||
monero-p2p = { path = "../../p2p/monero-p2p" }
|
||||
dandelion-tower = { path = "../../p2p/dandelion" }
|
||||
|
||||
# Databases
|
||||
cuprate-blockchain = { path = "../../storage/cuprate-blockchain" }
|
||||
|
||||
# Consensus
|
||||
cuprate-consensus = { path = "../../consensus" }
|
||||
|
||||
# Async
|
||||
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
|
||||
futures = { workspace = true }
|
||||
|
||||
# Utils
|
||||
bytes = { workspace = true }
|
||||
|
7
binaries/cuprated/src/main.rs
Normal file
7
binaries/cuprated/src/main.rs
Normal file
|
@ -0,0 +1,7 @@
|
|||
mod network;
|
||||
mod p2p_request_handler;
|
||||
mod syncer;
|
||||
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
26
binaries/cuprated/src/network.rs
Normal file
26
binaries/cuprated/src/network.rs
Normal file
|
@ -0,0 +1,26 @@
|
|||
use bytes::Bytes;
|
||||
use dandelion_tower::TxState;
|
||||
use futures::Stream;
|
||||
|
||||
/// A trait representing the whole P2P network, including all network zones.
|
||||
///
|
||||
/// [`cuprate_p2p`] provides a per [`NetworkZone`](monero_p2p::NetworkZone) abstraction in [`TODO`], this trait
|
||||
/// provides a full abstraction, just exposing a minimal interface for Cuprate to interact with.
|
||||
///
|
||||
/// It's methods will handle routing to the different [`NetworkZone`](monero_p2p::NetworkZone)s when required.
|
||||
///
|
||||
/// This is kept generic for testing purposes.
|
||||
trait P2PNetwork: Clone {
|
||||
/// An identifier for a node on any [`NetworkZone`](monero_p2p::NetworkZone)
|
||||
type PeerID;
|
||||
/// The block downloader stream.
|
||||
type BlockDownloader: Stream<Item = ()>;
|
||||
|
||||
/// Broadcasts a block to the network.
|
||||
fn broadcast_block(&mut self, block_bytes: Bytes, chain_height: u64);
|
||||
|
||||
/// Broadcasts a transaction to the network.
|
||||
fn broadcast_transaction(&mut self, tx_bytes: Bytes, state: TxState<Self::PeerID>);
|
||||
|
||||
fn block_downloader(&mut self) -> Self::BlockDownloader;
|
||||
}
|
0
binaries/cuprated/src/p2p_request_handler.rs
Normal file
0
binaries/cuprated/src/p2p_request_handler.rs
Normal file
4
binaries/cuprated/src/syncer.rs
Normal file
4
binaries/cuprated/src/syncer.rs
Normal file
|
@ -0,0 +1,4 @@
|
|||
//! # The Syncer
|
||||
//!
|
||||
//! The syncer is the part of Cuprate that handles keeping the blockchain state, it handles syncing if
|
||||
//! we have fallen behind, and it handles incoming blocks.
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "dandelion_tower"
|
||||
name = "dandelion-tower"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
|
|
Loading…
Reference in a new issue