From de320714fbe46e4fda858d5c1c07f5dd1cc842f0 Mon Sep 17 00:00:00 2001 From: rustaceanrob Date: Tue, 27 May 2025 15:20:01 +0100 Subject: [PATCH] Introduce empty p2p messages crate Peer to peer messages change on occasion, and we would like to add messages as they are release from Bitcoin Core. Add an empty crate to take the crate name. --- Cargo-minimal.lock | 4 ++++ Cargo-recent.lock | 4 ++++ Cargo.toml | 2 +- p2p/CHANGELOG.md | 3 +++ p2p/Cargo.toml | 21 +++++++++++++++++++++ p2p/README.md | 12 ++++++++++++ p2p/contrib/test_vars.sh | 14 ++++++++++++++ p2p/src/lib.rs | 16 ++++++++++++++++ 8 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 p2p/CHANGELOG.md create mode 100644 p2p/Cargo.toml create mode 100644 p2p/README.md create mode 100644 p2p/contrib/test_vars.sh create mode 100644 p2p/src/lib.rs diff --git a/Cargo-minimal.lock b/Cargo-minimal.lock index 211aa646a..1ff3ceaa3 100644 --- a/Cargo-minimal.lock +++ b/Cargo-minimal.lock @@ -106,6 +106,10 @@ dependencies = [ "bitcoin_hashes 0.16.0", ] +[[package]] +name = "bitcoin-p2p-messages" +version = "0.1.0" + [[package]] name = "bitcoin-primitives" version = "0.101.0" diff --git a/Cargo-recent.lock b/Cargo-recent.lock index e886abeca..edfae1793 100644 --- a/Cargo-recent.lock +++ b/Cargo-recent.lock @@ -105,6 +105,10 @@ dependencies = [ "bitcoin_hashes 0.16.0", ] +[[package]] +name = "bitcoin-p2p-messages" +version = "0.1.0" + [[package]] name = "bitcoin-primitives" version = "0.101.0" diff --git a/Cargo.toml b/Cargo.toml index 7d9a5d526..d46771295 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace] -members = ["addresses", "base58", "bitcoin", "chacha20_poly1305", "fuzz", "hashes", "internals", "io", "primitives", "units"] +members = ["addresses", "base58", "bitcoin", "chacha20_poly1305", "fuzz", "hashes", "internals", "io", "p2p", "primitives", "units"] resolver = "2" # Keep this patch for hashes because secp256k1 depends on bitcoin-hashes via crates.io diff --git a/p2p/CHANGELOG.md b/p2p/CHANGELOG.md new file mode 100644 index 000000000..4c310ad4b --- /dev/null +++ b/p2p/CHANGELOG.md @@ -0,0 +1,3 @@ +# 0.1.0 - 2025-05-27 + +* Initial release of the `github.com/rust-bitcoin/rust-bitcoin/p2p` crate as `bitcoin-p2p-messages`. diff --git a/p2p/Cargo.toml b/p2p/Cargo.toml new file mode 100644 index 000000000..37166211c --- /dev/null +++ b/p2p/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "bitcoin-p2p-messages" +version = "0.1.0" +authors = ["Andrew Poelstra "] +license = "CC0-1.0" +repository = "https://github.com/rust-bitcoin/rust-bitcoin" +description = "Peer-to-peer messages defined by the Bitcoin protocol" +categories = ["cryptography::cryptocurrencies"] +keywords = ["bitcoin", "peer-to-peer"] +readme = "README.md" +edition = "2021" +rust-version = "1.63.0" +exclude = ["tests", "contrib"] + +[dependencies] + +[dev-dependencies] + +[package.metadata.docs.rs] +all-features = true +rustdoc-args = ["--cfg", "docsrs"] diff --git a/p2p/README.md b/p2p/README.md new file mode 100644 index 000000000..f4fe096e4 --- /dev/null +++ b/p2p/README.md @@ -0,0 +1,12 @@ +# Rust Bitcoin Peer to Peer Message Types + +This crate provides data types used in the Bitcoin peer-to-peer protocol. + +## Minimum Supported Rust Version (MSRV) + +This library should always compile with any combination of features on **Rust 1.63.0**. + +## Licensing + +The code in this project is licensed under the [Creative Commons CC0 1.0 Universal license](LICENSE). +We use the [SPDX license list](https://spdx.org/licenses/) and [SPDX IDs](https://spdx.dev/ids/). diff --git a/p2p/contrib/test_vars.sh b/p2p/contrib/test_vars.sh new file mode 100644 index 000000000..88e2d26e1 --- /dev/null +++ b/p2p/contrib/test_vars.sh @@ -0,0 +1,14 @@ +# No shebang, this file should not be executed. +# shellcheck disable=SC2148 +# +# disable verify unused vars, despite the fact that they are used when sourced +# shellcheck disable=SC2034 + +# Test all these features with "std" enabled. +FEATURES_WITH_STD="" + +# Test all these features without "std" enabled. +FEATURES_WITHOUT_STD="" + +# Run these examples. +EXAMPLES="" diff --git a/p2p/src/lib.rs b/p2p/src/lib.rs new file mode 100644 index 000000000..bb9afc7d9 --- /dev/null +++ b/p2p/src/lib.rs @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: CC0-1.0 + +//! # Rust Bitcoin Peer to Peer Message Types + +// Experimental features we need. +#![cfg_attr(docsrs, feature(doc_auto_cfg))] +// Coding conventions. +#![warn(missing_docs)] +#![warn(deprecated_in_future)] +#![doc(test(attr(warn(unused))))] +// Pedantic lints that we enforce. +#![warn(clippy::return_self_not_must_use)] +// Exclude lints we don't think are valuable. +#![allow(clippy::needless_question_mark)] // https://github.com/rust-bitcoin/rust-bitcoin/pull/2134 +#![allow(clippy::manual_range_contains)] // More readable than clippy's format. +#![allow(clippy::uninlined_format_args)] // Allow `format!("{}", x)`instead of enforcing `format!("{x}")`