From c79c0d9d32e95094aee144e47361b8dbae810165 Mon Sep 17 00:00:00 2001 From: raph Date: Mon, 9 Sep 2024 09:36:58 +0200 Subject: [PATCH] Add MSRV for 1.63 (#34) --- Cargo.toml | 7 ++++--- README.md | 4 ++++ justfile | 3 +++ src/verify.rs | 8 ++++++-- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 950e733..cb58729 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,18 +2,19 @@ name = "bip322" version = "0.0.7" edition = "2021" -description = "Implements BIP322 generic message signing" +description = "Implements BIP322 generic message signing and verification" license = "CC0-1.0" homepage = "https://bip322.rs" repository = "https://github.com/raphjaph/bip322" +rust-version = "1.63" [dependencies] base64 = "0.22.1" -bitcoin = { version = "0.31.2" } +bitcoin = "0.31.2" bitcoin_hashes = "0.14.0" hex = "0.4.3" miniscript = "11.0.0" -snafu = "0.8.4" +snafu = { version = "0.8.4", default-features = false, features = ["rust_1_61", "std"] } [dev-dependencies] pretty_assertions = "1.4.0" diff --git a/README.md b/README.md index ef9ea73..775ccf2 100644 --- a/README.md +++ b/README.md @@ -42,3 +42,7 @@ The WASM binary and Javascript glue code can then be found in `www/pkg`. The [bip322.rs](https://bip322.rs) site also runs a small WASM binary if you'd like to check it out. +## MSRV + +At the moment the Minimum Supported Rust Version (MSRV) is 1.63. You can check +it by running `just msrv`. diff --git a/justfile b/justfile index 706f4bb..a098120 100644 --- a/justfile +++ b/justfile @@ -20,6 +20,9 @@ outdated: coverage: cargo llvm-cov +msrv: + cargo msrv verify -- rustup run 1.63 cargo check + wasm: AR=/opt/homebrew/opt/llvm/bin/llvm-ar \ CC=/opt/homebrew/opt/llvm/bin/clang \ diff --git a/src/verify.rs b/src/verify.rs index 6c58957..2fb568e 100644 --- a/src/verify.rs +++ b/src/verify.rs @@ -100,7 +100,9 @@ fn verify_full_p2wpkh( return Err(Error::ToSignInvalid); } - let Some(witness) = to_sign.inputs[0].final_script_witness.clone() else { + let witness = if let Some(witness) = to_sign.inputs[0].final_script_witness.clone() { + witness + } else { return Err(Error::WitnessEmpty); }; @@ -182,7 +184,9 @@ fn verify_full_p2tr( return Err(Error::ToSignInvalid); } - let Some(witness) = to_sign.inputs[0].final_script_witness.clone() else { + let witness = if let Some(witness) = to_sign.inputs[0].final_script_witness.clone() { + witness + } else { return Err(Error::WitnessEmpty); };