From 062b3d76b94ce54ef56c2c421a3e11340365e20f Mon Sep 17 00:00:00 2001 From: Andrzej Sulkowski <111314156+andrzejSulkowski@users.noreply.github.com> Date: Thu, 25 Apr 2024 20:36:09 +0200 Subject: [PATCH] refactor: move network-txpool.rs example to its own folder (#7892) Co-authored-by: Oliver Nordbjerg --- Cargo.lock | 11 +++++++++++ Cargo.toml | 1 + examples/Cargo.toml | 7 +------ examples/README.md | 6 +++--- examples/network-txpool/Cargo.toml | 13 +++++++++++++ .../src/main.rs} | 2 +- 6 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 examples/network-txpool/Cargo.toml rename examples/{network-txpool.rs => network-txpool/src/main.rs} (98%) diff --git a/Cargo.lock b/Cargo.lock index 256d5e4b6..0df1d9fd3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4864,6 +4864,17 @@ dependencies = [ "unsigned-varint 0.7.2", ] +[[package]] +name = "network-txpool" +version = "0.0.0" +dependencies = [ + "eyre", + "reth-network", + "reth-provider", + "reth-transaction-pool", + "tokio", +] + [[package]] name = "nibble_vec" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 7b9b63e95..04e26fc44 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -80,6 +80,7 @@ members = [ "examples/custom-dev-node/", "examples/custom-payload-builder/", "examples/manual-p2p/", + "examples/network-txpool/", "examples/rpc-db/", "examples/txpool-tracing/", "examples/polygon-p2p/", diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 82b6be45a..2379e9a0f 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -31,9 +31,4 @@ path = "db-access.rs" [[example]] name = "network" -path = "network.rs" - -[[example]] -name = "network-txpool" -path = "network-txpool.rs" - +path = "network.rs" \ No newline at end of file diff --git a/examples/README.md b/examples/README.md index db0bdb999..dcec15d35 100644 --- a/examples/README.md +++ b/examples/README.md @@ -48,10 +48,10 @@ to make a PR! ## Mempool -| Example | Description | -| ----------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| Example | Description | +|------------------------------------------------------| -------------------------------------------------------------------------------------------------------------------------- | | [Trace pending transactions](./txpool-tracing) | Illustrates how to trace pending transactions as they arrive in the mempool | -| [Standalone txpool](./network-txpool.rs) | Illustrates how to use the network as a standalone component together with a transaction pool with a custom pool validator | +| [Standalone txpool](./network-txpool) | Illustrates how to use the network as a standalone component together with a transaction pool with a custom pool validator | ## P2P diff --git a/examples/network-txpool/Cargo.toml b/examples/network-txpool/Cargo.toml new file mode 100644 index 000000000..12544a8f3 --- /dev/null +++ b/examples/network-txpool/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "network-txpool" +version = "0.0.0" +publish = false +edition.workspace = true +license.workspace = true + +[dependencies] +reth-provider = { workspace = true, features = ["test-utils"] } +eyre.workspace = true +tokio.workspace = true +reth-network.workspace = true +reth-transaction-pool.workspace = true diff --git a/examples/network-txpool.rs b/examples/network-txpool/src/main.rs similarity index 98% rename from examples/network-txpool.rs rename to examples/network-txpool/src/main.rs index 0af120a89..6f8d69eab 100644 --- a/examples/network-txpool.rs +++ b/examples/network-txpool/src/main.rs @@ -4,7 +4,7 @@ //! Run with //! //! ```not_rust -//! cargo run --example network-txpool +//! cargo run --release -p network-txpool -- node //! ``` use reth_network::{config::rng_secret_key, NetworkConfig, NetworkManager};