Bump MSRV to 1.63
The version 1.63 satisfies our requirements for MSRV and provides significant benefits so this commit bumps it. This commit also starts using some advantages of the new MSRV, namely namespaced features, weak dependencies and the ability to use trait bounds in `const` context. This however does not yet migrade the `rand-std` feature because that requires a release of `secp256k1` with the same kind of change - bumping MSRV to 1.63 and removing `rand-std` in favor of weak dependency.
This commit is contained in:
parent
1276a99061
commit
c72069e921
|
@ -70,7 +70,7 @@ jobs:
|
||||||
run: ./maintainer-tools/ci/run_task.sh nightly
|
run: ./maintainer-tools/ci/run_task.sh nightly
|
||||||
|
|
||||||
MSRV: # 2 jobs, one per manifest.
|
MSRV: # 2 jobs, one per manifest.
|
||||||
name: Test - 1.56.1 toolchain
|
name: Test - MSRV toolchain
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
@ -88,7 +88,7 @@ jobs:
|
||||||
- name: "Select toolchain"
|
- name: "Select toolchain"
|
||||||
uses: dtolnay/rust-toolchain@stable
|
uses: dtolnay/rust-toolchain@stable
|
||||||
with:
|
with:
|
||||||
toolchain: "1.56.1"
|
toolchain: "1.63.0"
|
||||||
- name: "Set dependencies"
|
- name: "Set dependencies"
|
||||||
run: cp Cargo-${{ matrix.dep }}.lock Cargo.lock
|
run: cp Cargo-${{ matrix.dep }}.lock Cargo.lock
|
||||||
- name: "Run test script"
|
- name: "Run test script"
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<a href="https://github.com/rust-bitcoin/rust-bitcoin/blob/master/LICENSE"><img alt="CC0 1.0 Universal Licensed" src="https://img.shields.io/badge/license-CC0--1.0-blue.svg"/></a>
|
<a href="https://github.com/rust-bitcoin/rust-bitcoin/blob/master/LICENSE"><img alt="CC0 1.0 Universal Licensed" src="https://img.shields.io/badge/license-CC0--1.0-blue.svg"/></a>
|
||||||
<a href="https://github.com/rust-bitcoin/rust-bitcoin/actions?query=workflow%3AContinuous%20integration"><img alt="CI Status" src="https://github.com/rust-bitcoin/rust-bitcoin/workflows/Continuous%20integration/badge.svg"></a>
|
<a href="https://github.com/rust-bitcoin/rust-bitcoin/actions?query=workflow%3AContinuous%20integration"><img alt="CI Status" src="https://github.com/rust-bitcoin/rust-bitcoin/workflows/Continuous%20integration/badge.svg"></a>
|
||||||
<a href="https://docs.rs/bitcoin"><img alt="API Docs" src="https://img.shields.io/badge/docs.rs-bitcoin-green"/></a>
|
<a href="https://docs.rs/bitcoin"><img alt="API Docs" src="https://img.shields.io/badge/docs.rs-bitcoin-green"/></a>
|
||||||
<a href="https://blog.rust-lang.org/2021/11/01/Rust-1.56.1.html"><img alt="Rustc Version 1.56.1+" src="https://img.shields.io/badge/rustc-1.56.1%2B-lightgrey.svg"/></a>
|
<a href="https://blog.rust-lang.org/2021/11/01/Rust-1.63.0.html"><img alt="Rustc Version 1.63.0+" src="https://img.shields.io/badge/rustc-1.63.0%2B-lightgrey.svg"/></a>
|
||||||
<a href="https://gnusha.org/bitcoin-rust/"><img alt="Chat on IRC" src="https://img.shields.io/badge/irc-%23bitcoin--rust%20on%20libera.chat-blue"></a>
|
<a href="https://gnusha.org/bitcoin-rust/"><img alt="Chat on IRC" src="https://img.shields.io/badge/irc-%23bitcoin--rust%20on%20libera.chat-blue"></a>
|
||||||
<a href="https://github.com/model-checking/kani"><imp alt="kani" src="https://github.com/rust-bitcoin/rust-bitcoin/actions/workflows/kani.yaml/badge.svg"></a>
|
<a href="https://github.com/model-checking/kani"><imp alt="kani" src="https://github.com/rust-bitcoin/rust-bitcoin/actions/workflows/kani.yaml/badge.svg"></a>
|
||||||
</p>
|
</p>
|
||||||
|
@ -69,7 +69,7 @@ For more information please see [`CONTRIBUTING.md`](./CONTRIBUTING.md).
|
||||||
|
|
||||||
## Minimum Supported Rust Version (MSRV)
|
## Minimum Supported Rust Version (MSRV)
|
||||||
|
|
||||||
This library should always compile with any combination of features on **Rust 1.56.1**.
|
This library should always compile with any combination of features on **Rust 1.63.0**.
|
||||||
|
|
||||||
Use `Cargo-minimal.lock` to build the MSRV by copying to `Cargo.lock` and building.
|
Use `Cargo-minimal.lock` to build the MSRV by copying to `Cargo.lock` and building.
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ categories = ["cryptography::cryptocurrencies"]
|
||||||
keywords = ["bitcoin", "types"]
|
keywords = ["bitcoin", "types"]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.56.1"
|
rust-version = "1.63.0"
|
||||||
exclude = ["tests", "contrib"]
|
exclude = ["tests", "contrib"]
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
|
|
@ -4,4 +4,4 @@ Types and logic required to receive bitcoin - i.e., bitcoin addresses.
|
||||||
|
|
||||||
## Minimum Supported Rust Version (MSRV)
|
## Minimum Supported Rust Version (MSRV)
|
||||||
|
|
||||||
This library should always compile with any combination of features on **Rust 1.56.1**.
|
This library should always compile with any combination of features on **Rust 1.63.0**.
|
||||||
|
|
|
@ -9,7 +9,7 @@ categories = ["cryptography::cryptocurrencies", "encoding"]
|
||||||
keywords = ["bitcoin", "base58", "encode", "decode", "checksum"]
|
keywords = ["bitcoin", "base58", "encode", "decode", "checksum"]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.56.1"
|
rust-version = "1.63.0"
|
||||||
exclude = ["tests", "contrib"]
|
exclude = ["tests", "contrib"]
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
|
|
@ -22,7 +22,7 @@ the checksum.
|
||||||
|
|
||||||
## Minimum Supported Rust Version (MSRV)
|
## Minimum Supported Rust Version (MSRV)
|
||||||
|
|
||||||
This library should always compile with any combination of features on **Rust 1.56.1**.
|
This library should always compile with any combination of features on **Rust 1.63.0**.
|
||||||
|
|
||||||
## Licensing
|
## Licensing
|
||||||
|
|
||||||
|
|
|
@ -10,19 +10,18 @@ categories = ["cryptography::cryptocurrencies"]
|
||||||
keywords = [ "crypto", "bitcoin" ]
|
keywords = [ "crypto", "bitcoin" ]
|
||||||
readme = "../README.md"
|
readme = "../README.md"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.56.1"
|
rust-version = "1.63.0"
|
||||||
exclude = ["tests", "contrib"]
|
exclude = ["tests", "contrib"]
|
||||||
|
|
||||||
# If you change features or optional dependencies in any way please update the "# Cargo features" section in lib.rs as well.
|
# If you change features or optional dependencies in any way please update the "# Cargo features" section in lib.rs as well.
|
||||||
[features]
|
[features]
|
||||||
default = [ "std", "secp-recovery" ]
|
default = [ "std", "secp-recovery" ]
|
||||||
std = ["base58/std", "bech32/std", "hashes/std", "hex/std", "internals/std", "io/std", "primitives/std", "secp256k1/std", "units/std"]
|
std = ["base58/std", "bech32/std", "hashes/std", "hex/std", "internals/std", "io/std", "primitives/std", "secp256k1/std", "units/std", "bitcoinconsensus?/std"]
|
||||||
rand-std = ["secp256k1/rand-std", "std"]
|
rand-std = ["secp256k1/rand-std", "std"]
|
||||||
rand = ["secp256k1/rand"]
|
rand = ["secp256k1/rand"]
|
||||||
serde = ["actual-serde", "hashes/serde", "internals/serde", "primitives/serde", "secp256k1/serde", "units/serde"]
|
serde = ["dep:serde", "hashes/serde", "internals/serde", "primitives/serde", "secp256k1/serde", "units/serde"]
|
||||||
secp-lowmemory = ["secp256k1/lowmemory"]
|
secp-lowmemory = ["secp256k1/lowmemory"]
|
||||||
secp-recovery = ["secp256k1/recovery"]
|
secp-recovery = ["secp256k1/recovery"]
|
||||||
bitcoinconsensus-std = ["bitcoinconsensus/std", "std"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
base58 = { package = "base58ck", version = "0.1.0", default-features = false, features = ["alloc"] }
|
base58 = { package = "base58ck", version = "0.1.0", default-features = false, features = ["alloc"] }
|
||||||
|
@ -37,11 +36,9 @@ units = { package = "bitcoin-units", version = "0.1.0", default-features = false
|
||||||
|
|
||||||
base64 = { version = "0.22.0", optional = true }
|
base64 = { version = "0.22.0", optional = true }
|
||||||
ordered = { version = "0.2.0", optional = true }
|
ordered = { version = "0.2.0", optional = true }
|
||||||
# Only use this feature for no-std builds, otherwise use bitcoinconsensus-std.
|
|
||||||
bitcoinconsensus = { version = "0.106.0+26", default-features = false, optional = true }
|
bitcoinconsensus = { version = "0.106.0+26", default-features = false, optional = true }
|
||||||
|
|
||||||
# Do NOT use this as a feature! Use the `serde` feature instead.
|
serde = { version = "1.0.103", default-features = false, features = [ "derive", "alloc" ], optional = true }
|
||||||
actual-serde = { package = "serde", version = "1.0.103", default-features = false, features = [ "derive", "alloc" ], optional = true }
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
internals = { package = "bitcoin-internals", version = "0.3.0", features = ["test-serde"] }
|
internals = { package = "bitcoin-internals", version = "0.3.0", features = ["test-serde"] }
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
|
|
||||||
# Test all these features with "std" enabled.
|
# Test all these features with "std" enabled.
|
||||||
FEATURES_WITH_STD="rand-std serde secp-recovery bitcoinconsensus-std base64 ordered"
|
FEATURES_WITH_STD="rand-std serde secp-recovery bitcoinconsensus base64 ordered"
|
||||||
|
|
||||||
# Test all these features without "std" or "alloc" enabled.
|
# Test all these features without "std" or "alloc" enabled.
|
||||||
FEATURES_WITHOUT_STD="rand serde secp-recovery bitcoinconsensus base64 ordered"
|
FEATURES_WITHOUT_STD="rand serde secp-recovery bitcoinconsensus base64 ordered"
|
||||||
|
|
|
@ -49,7 +49,6 @@ impl BlockHash {
|
||||||
/// * [CBlockHeader definition](https://github.com/bitcoin/bitcoin/blob/345457b542b6a980ccfbc868af0970a6f91d1b82/src/primitives/block.h#L20)
|
/// * [CBlockHeader definition](https://github.com/bitcoin/bitcoin/blob/345457b542b6a980ccfbc868af0970a6f91d1b82/src/primitives/block.h#L20)
|
||||||
#[derive(Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash)]
|
#[derive(Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
|
|
||||||
pub struct Header {
|
pub struct Header {
|
||||||
/// Block version, now repurposed for soft fork signalling.
|
/// Block version, now repurposed for soft fork signalling.
|
||||||
pub version: Version,
|
pub version: Version,
|
||||||
|
@ -142,7 +141,6 @@ impl fmt::Debug for Header {
|
||||||
/// * [BIP34 - Block v2, Height in Coinbase](https://github.com/bitcoin/bips/blob/master/bip-0034.mediawiki)
|
/// * [BIP34 - Block v2, Height in Coinbase](https://github.com/bitcoin/bips/blob/master/bip-0034.mediawiki)
|
||||||
#[derive(Copy, PartialEq, Eq, Clone, Debug, PartialOrd, Ord, Hash)]
|
#[derive(Copy, PartialEq, Eq, Clone, Debug, PartialOrd, Ord, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
|
|
||||||
pub struct Version(i32);
|
pub struct Version(i32);
|
||||||
|
|
||||||
impl Version {
|
impl Version {
|
||||||
|
@ -223,7 +221,6 @@ impl Decodable for Version {
|
||||||
/// * [CBlock definition](https://github.com/bitcoin/bitcoin/blob/345457b542b6a980ccfbc868af0970a6f91d1b82/src/primitives/block.h#L62)
|
/// * [CBlock definition](https://github.com/bitcoin/bitcoin/blob/345457b542b6a980ccfbc868af0970a6f91d1b82/src/primitives/block.h#L62)
|
||||||
#[derive(PartialEq, Eq, Clone, Debug)]
|
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
|
|
||||||
pub struct Block {
|
pub struct Block {
|
||||||
/// The block header
|
/// The block header
|
||||||
pub header: Header,
|
pub header: Header,
|
||||||
|
|
|
@ -230,7 +230,6 @@ impl core::str::FromStr for OutPoint {
|
||||||
/// * [CTxIn definition](https://github.com/bitcoin/bitcoin/blob/345457b542b6a980ccfbc868af0970a6f91d1b82/src/primitives/transaction.h#L65)
|
/// * [CTxIn definition](https://github.com/bitcoin/bitcoin/blob/345457b542b6a980ccfbc868af0970a6f91d1b82/src/primitives/transaction.h#L65)
|
||||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
|
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
|
|
||||||
pub struct TxIn {
|
pub struct TxIn {
|
||||||
/// The reference to the previous output that is being used as an input.
|
/// The reference to the previous output that is being used as an input.
|
||||||
pub previous_output: OutPoint,
|
pub previous_output: OutPoint,
|
||||||
|
@ -339,7 +338,6 @@ impl Default for TxIn {
|
||||||
/// * [CTxOut definition](https://github.com/bitcoin/bitcoin/blob/345457b542b6a980ccfbc868af0970a6f91d1b82/src/primitives/transaction.h#L148)
|
/// * [CTxOut definition](https://github.com/bitcoin/bitcoin/blob/345457b542b6a980ccfbc868af0970a6f91d1b82/src/primitives/transaction.h#L148)
|
||||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
|
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
|
|
||||||
pub struct TxOut {
|
pub struct TxOut {
|
||||||
/// The value of the output, in satoshis.
|
/// The value of the output, in satoshis.
|
||||||
pub value: Amount,
|
pub value: Amount,
|
||||||
|
@ -464,7 +462,6 @@ fn size_from_script_pubkey(script_pubkey: &Script) -> usize {
|
||||||
/// transitioning from 0.29 to 0.30.
|
/// transitioning from 0.29 to 0.30.
|
||||||
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
|
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
|
|
||||||
pub struct Transaction {
|
pub struct Transaction {
|
||||||
/// The protocol version, is currently expected to be 1 or 2 (BIP 68).
|
/// The protocol version, is currently expected to be 1 or 2 (BIP 68).
|
||||||
pub version: Version,
|
pub version: Version,
|
||||||
|
@ -924,7 +921,6 @@ impl std::error::Error for IndexOutOfBoundsError {
|
||||||
/// [BIP-68]: https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki
|
/// [BIP-68]: https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki
|
||||||
#[derive(Copy, PartialEq, Eq, Clone, Debug, PartialOrd, Ord, Hash)]
|
#[derive(Copy, PartialEq, Eq, Clone, Debug, PartialOrd, Ord, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
|
|
||||||
pub struct Version(pub i32);
|
pub struct Version(pub i32);
|
||||||
|
|
||||||
impl Version {
|
impl Version {
|
||||||
|
|
|
@ -405,12 +405,11 @@ where
|
||||||
/// To (de)serialize a field using consensus encoding you can write e.g.:
|
/// To (de)serialize a field using consensus encoding you can write e.g.:
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// # use actual_serde::{Serialize, Deserialize};
|
/// # use serde::{Serialize, Deserialize};
|
||||||
/// use bitcoin::Transaction;
|
/// use bitcoin::Transaction;
|
||||||
/// use bitcoin::consensus;
|
/// use bitcoin::consensus;
|
||||||
///
|
///
|
||||||
/// #[derive(Serialize, Deserialize)]
|
/// #[derive(Serialize, Deserialize)]
|
||||||
/// # #[serde(crate = "actual_serde")]
|
|
||||||
/// pub struct MyStruct {
|
/// pub struct MyStruct {
|
||||||
/// #[serde(with = "consensus::serde::With::<consensus::serde::Hex>")]
|
/// #[serde(with = "consensus::serde::With::<consensus::serde::Hex>")]
|
||||||
/// tx: Transaction,
|
/// tx: Transaction,
|
||||||
|
|
|
@ -200,16 +200,11 @@ impl fmt::Display for BitcoinconsensusError {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "std", feature = "bitcoinconsensus-std"))]
|
#[cfg(all(feature = "std", feature = "bitcoinconsensus"))]
|
||||||
impl std::error::Error for BitcoinconsensusError {
|
impl std::error::Error for BitcoinconsensusError {
|
||||||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { Some(&self.0) }
|
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { Some(&self.0) }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(feature = "std", not(feature = "bitcoinconsensus-std")))]
|
|
||||||
impl std::error::Error for BitcoinconsensusError {
|
|
||||||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { None }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// An error during transaction validation.
|
/// An error during transaction validation.
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
|
|
|
@ -20,7 +20,6 @@ const MAX_SIG_LEN: usize = 73;
|
||||||
/// An ECDSA signature with the corresponding hash type.
|
/// An ECDSA signature with the corresponding hash type.
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
|
|
||||||
pub struct Signature {
|
pub struct Signature {
|
||||||
/// The underlying ECDSA Signature.
|
/// The underlying ECDSA Signature.
|
||||||
pub signature: secp256k1::ecdsa::Signature,
|
pub signature: secp256k1::ecdsa::Signature,
|
||||||
|
|
|
@ -694,7 +694,6 @@ pub type UntweakedPublicKey = XOnlyPublicKey;
|
||||||
/// Tweaked BIP-340 X-coord-only public key.
|
/// Tweaked BIP-340 X-coord-only public key.
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
|
|
||||||
#[cfg_attr(feature = "serde", serde(transparent))]
|
#[cfg_attr(feature = "serde", serde(transparent))]
|
||||||
pub struct TweakedPublicKey(XOnlyPublicKey);
|
pub struct TweakedPublicKey(XOnlyPublicKey);
|
||||||
|
|
||||||
|
@ -727,7 +726,6 @@ pub type UntweakedKeypair = Keypair;
|
||||||
/// ```
|
/// ```
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
|
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
|
|
||||||
#[cfg_attr(feature = "serde", serde(transparent))]
|
#[cfg_attr(feature = "serde", serde(transparent))]
|
||||||
pub struct TweakedKeypair(Keypair);
|
pub struct TweakedKeypair(Keypair);
|
||||||
|
|
||||||
|
|
|
@ -1788,9 +1788,9 @@ mod tests {
|
||||||
|
|
||||||
fn sighash_deser_numeric<'de, D>(deserializer: D) -> Result<TapSighashType, D::Error>
|
fn sighash_deser_numeric<'de, D>(deserializer: D) -> Result<TapSighashType, D::Error>
|
||||||
where
|
where
|
||||||
D: actual_serde::Deserializer<'de>,
|
D: serde::Deserializer<'de>,
|
||||||
{
|
{
|
||||||
use actual_serde::de::{Deserialize, Error, Unexpected};
|
use serde::de::{Deserialize, Error, Unexpected};
|
||||||
|
|
||||||
let raw = u8::deserialize(deserializer)?;
|
let raw = u8::deserialize(deserializer)?;
|
||||||
TapSighashType::from_consensus_u8(raw).map_err(|_| {
|
TapSighashType::from_consensus_u8(raw).map_err(|_| {
|
||||||
|
@ -1807,7 +1807,6 @@ mod tests {
|
||||||
use crate::taproot::{TapNodeHash, TapTweakHash};
|
use crate::taproot::{TapNodeHash, TapTweakHash};
|
||||||
|
|
||||||
#[derive(serde::Deserialize)]
|
#[derive(serde::Deserialize)]
|
||||||
#[serde(crate = "actual_serde")]
|
|
||||||
struct UtxoSpent {
|
struct UtxoSpent {
|
||||||
#[serde(rename = "scriptPubKey")]
|
#[serde(rename = "scriptPubKey")]
|
||||||
script_pubkey: ScriptBuf,
|
script_pubkey: ScriptBuf,
|
||||||
|
@ -1817,7 +1816,6 @@ mod tests {
|
||||||
|
|
||||||
#[derive(serde::Deserialize)]
|
#[derive(serde::Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[serde(crate = "actual_serde")]
|
|
||||||
struct KpsGiven {
|
struct KpsGiven {
|
||||||
#[serde(with = "con_serde::With::<con_serde::Hex>")]
|
#[serde(with = "con_serde::With::<con_serde::Hex>")]
|
||||||
raw_unsigned_tx: Transaction,
|
raw_unsigned_tx: Transaction,
|
||||||
|
@ -1826,7 +1824,6 @@ mod tests {
|
||||||
|
|
||||||
#[derive(serde::Deserialize)]
|
#[derive(serde::Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[serde(crate = "actual_serde")]
|
|
||||||
struct KpsIntermediary {
|
struct KpsIntermediary {
|
||||||
hash_prevouts: sha256::Hash,
|
hash_prevouts: sha256::Hash,
|
||||||
hash_outputs: sha256::Hash,
|
hash_outputs: sha256::Hash,
|
||||||
|
@ -1837,7 +1834,6 @@ mod tests {
|
||||||
|
|
||||||
#[derive(serde::Deserialize)]
|
#[derive(serde::Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[serde(crate = "actual_serde")]
|
|
||||||
struct KpsInputSpendingGiven {
|
struct KpsInputSpendingGiven {
|
||||||
txin_index: usize,
|
txin_index: usize,
|
||||||
internal_privkey: SecretKey,
|
internal_privkey: SecretKey,
|
||||||
|
@ -1848,7 +1844,6 @@ mod tests {
|
||||||
|
|
||||||
#[derive(serde::Deserialize)]
|
#[derive(serde::Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[serde(crate = "actual_serde")]
|
|
||||||
struct KpsInputSpendingIntermediary {
|
struct KpsInputSpendingIntermediary {
|
||||||
internal_pubkey: XOnlyPublicKey,
|
internal_pubkey: XOnlyPublicKey,
|
||||||
tweak: TapTweakHash,
|
tweak: TapTweakHash,
|
||||||
|
@ -1860,14 +1855,12 @@ mod tests {
|
||||||
|
|
||||||
#[derive(serde::Deserialize)]
|
#[derive(serde::Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[serde(crate = "actual_serde")]
|
|
||||||
struct KpsInputSpendingExpected {
|
struct KpsInputSpendingExpected {
|
||||||
witness: Vec<String>,
|
witness: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(serde::Deserialize)]
|
#[derive(serde::Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[serde(crate = "actual_serde")]
|
|
||||||
struct KpsInputSpending {
|
struct KpsInputSpending {
|
||||||
given: KpsInputSpendingGiven,
|
given: KpsInputSpendingGiven,
|
||||||
intermediary: KpsInputSpendingIntermediary,
|
intermediary: KpsInputSpendingIntermediary,
|
||||||
|
@ -1877,7 +1870,6 @@ mod tests {
|
||||||
|
|
||||||
#[derive(serde::Deserialize)]
|
#[derive(serde::Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[serde(crate = "actual_serde")]
|
|
||||||
struct KeyPathSpending {
|
struct KeyPathSpending {
|
||||||
given: KpsGiven,
|
given: KpsGiven,
|
||||||
intermediary: KpsIntermediary,
|
intermediary: KpsIntermediary,
|
||||||
|
@ -1886,7 +1878,6 @@ mod tests {
|
||||||
|
|
||||||
#[derive(serde::Deserialize)]
|
#[derive(serde::Deserialize)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
#[serde(crate = "actual_serde")]
|
|
||||||
struct TestData {
|
struct TestData {
|
||||||
version: u64,
|
version: u64,
|
||||||
key_path_spending: Vec<KeyPathSpending>,
|
key_path_spending: Vec<KeyPathSpending>,
|
||||||
|
|
|
@ -16,7 +16,6 @@ use crate::taproot::serialized_signature::{self, SerializedSignature};
|
||||||
/// A BIP340-341 serialized Taproot signature with the corresponding hash type.
|
/// A BIP340-341 serialized Taproot signature with the corresponding hash type.
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
|
|
||||||
pub struct Signature {
|
pub struct Signature {
|
||||||
/// The underlying schnorr signature.
|
/// The underlying schnorr signature.
|
||||||
pub signature: secp256k1::schnorr::Signature,
|
pub signature: secp256k1::schnorr::Signature,
|
||||||
|
|
|
@ -15,9 +15,6 @@
|
||||||
//!
|
//!
|
||||||
//! * `base64` (dependency) - enables encoding of PSBTs and message signatures.
|
//! * `base64` (dependency) - enables encoding of PSBTs and message signatures.
|
||||||
//! * `bitcoinconsensus` (dependency) - enables validating scripts and transactions.
|
//! * `bitcoinconsensus` (dependency) - enables validating scripts and transactions.
|
||||||
//! * `bitcoinconsensus-std` - same as `bitcoinconsensus` but also enables `std` here and in the
|
|
||||||
//! `bitcoinconsensus` crate. Additionally, enables returning
|
|
||||||
//! `bitcoinconsensus::Error` from `std::error::Error::source()`.
|
|
||||||
//! * `default` - enables `std` and `secp-recovery`.
|
//! * `default` - enables `std` and `secp-recovery`.
|
||||||
//! * `ordered` (dependency) - adds implementations of `ArbitraryOrd` to some structs.
|
//! * `ordered` (dependency) - adds implementations of `ArbitraryOrd` to some structs.
|
||||||
//! * `rand` (transitive dependency) - makes it more convenient to generate random values.
|
//! * `rand` (transitive dependency) - makes it more convenient to generate random values.
|
||||||
|
@ -79,7 +76,7 @@ pub extern crate secp256k1;
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate actual_serde as serde;
|
extern crate serde;
|
||||||
|
|
||||||
mod internal_macros;
|
mod internal_macros;
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
|
|
|
@ -65,7 +65,6 @@ impl From<Network> for NetworkKind {
|
||||||
/// The cryptocurrency network to act on.
|
/// The cryptocurrency network to act on.
|
||||||
#[derive(Copy, PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug)]
|
#[derive(Copy, PartialEq, Eq, PartialOrd, Ord, Clone, Hash, Debug)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
|
|
||||||
#[cfg_attr(feature = "serde", serde(rename_all = "lowercase"))]
|
#[cfg_attr(feature = "serde", serde(rename_all = "lowercase"))]
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
pub enum Network {
|
pub enum Network {
|
||||||
|
@ -425,7 +424,6 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn serde_as_core_arg() {
|
fn serde_as_core_arg() {
|
||||||
#[derive(Serialize, Deserialize, PartialEq, Debug)]
|
#[derive(Serialize, Deserialize, PartialEq, Debug)]
|
||||||
#[serde(crate = "actual_serde")]
|
|
||||||
struct T {
|
struct T {
|
||||||
#[serde(with = "crate::network::as_core_arg")]
|
#[serde(with = "crate::network::as_core_arg")]
|
||||||
pub network: Network,
|
pub network: Network,
|
||||||
|
|
|
@ -88,7 +88,6 @@ macro_rules! do_impl {
|
||||||
/// Work is a measure of how difficult it is to find a hash below a given [`Target`].
|
/// Work is a measure of how difficult it is to find a hash below a given [`Target`].
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
|
|
||||||
pub struct Work(U256);
|
pub struct Work(U256);
|
||||||
|
|
||||||
impl Work {
|
impl Work {
|
||||||
|
@ -124,7 +123,6 @@ impl Sub for Work {
|
||||||
/// ref: <https://en.bitcoin.it/wiki/Target>
|
/// ref: <https://en.bitcoin.it/wiki/Target>
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
|
|
||||||
pub struct Target(U256);
|
pub struct Target(U256);
|
||||||
|
|
||||||
impl Target {
|
impl Target {
|
||||||
|
@ -347,7 +345,6 @@ do_impl!(Target);
|
||||||
/// terms of the underlying `u32`.
|
/// terms of the underlying `u32`.
|
||||||
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
|
|
||||||
pub struct CompactTarget(u32);
|
pub struct CompactTarget(u32);
|
||||||
|
|
||||||
impl CompactTarget {
|
impl CompactTarget {
|
||||||
|
|
|
@ -67,7 +67,6 @@ const PSBT_IN_PROPRIETARY: u8 = 0xFC;
|
||||||
/// transaction.
|
/// transaction.
|
||||||
#[derive(Clone, Default, Debug, PartialEq, Eq, Hash)]
|
#[derive(Clone, Default, Debug, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
|
|
||||||
pub struct Input {
|
pub struct Input {
|
||||||
/// The non-witness transaction this input spends from. Should only be
|
/// The non-witness transaction this input spends from. Should only be
|
||||||
/// `Option::Some` for inputs which spend non-segwit outputs or
|
/// `Option::Some` for inputs which spend non-segwit outputs or
|
||||||
|
@ -148,7 +147,6 @@ pub struct Input {
|
||||||
/// ```
|
/// ```
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
|
|
||||||
pub struct PsbtSighashType {
|
pub struct PsbtSighashType {
|
||||||
pub(in crate::psbt) inner: u32,
|
pub(in crate::psbt) inner: u32,
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,6 @@ const PSBT_OUT_PROPRIETARY: u8 = 0xFC;
|
||||||
/// transaction.
|
/// transaction.
|
||||||
#[derive(Clone, Default, Debug, PartialEq, Eq, Hash)]
|
#[derive(Clone, Default, Debug, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
|
|
||||||
pub struct Output {
|
pub struct Output {
|
||||||
/// The redeem script for this output.
|
/// The redeem script for this output.
|
||||||
pub redeem_script: Option<ScriptBuf>,
|
pub redeem_script: Option<ScriptBuf>,
|
||||||
|
|
|
@ -39,7 +39,6 @@ pub use self::{
|
||||||
/// A Partially Signed Transaction.
|
/// A Partially Signed Transaction.
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
|
|
||||||
pub struct Psbt {
|
pub struct Psbt {
|
||||||
/// The unsigned transaction, scriptSigs and witnesses for each input must be empty.
|
/// The unsigned transaction, scriptSigs and witnesses for each input must be empty.
|
||||||
pub unsigned_tx: Transaction,
|
pub unsigned_tx: Transaction,
|
||||||
|
|
|
@ -21,7 +21,6 @@ use crate::psbt::Error;
|
||||||
/// `<key> := <keylen> <keytype> <keydata>`
|
/// `<key> := <keylen> <keytype> <keydata>`
|
||||||
#[derive(Debug, PartialEq, Hash, Eq, Clone, Ord, PartialOrd)]
|
#[derive(Debug, PartialEq, Hash, Eq, Clone, Ord, PartialOrd)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
|
|
||||||
pub struct Key {
|
pub struct Key {
|
||||||
/// The type of this PSBT key.
|
/// The type of this PSBT key.
|
||||||
pub type_value: u8,
|
pub type_value: u8,
|
||||||
|
@ -34,7 +33,6 @@ pub struct Key {
|
||||||
/// `<keypair> := <key> <value>`
|
/// `<keypair> := <key> <value>`
|
||||||
#[derive(Debug, PartialEq, Eq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
|
|
||||||
pub struct Pair {
|
pub struct Pair {
|
||||||
/// The key of this key-value pair.
|
/// The key of this key-value pair.
|
||||||
pub key: Key,
|
pub key: Key,
|
||||||
|
@ -51,7 +49,6 @@ pub type ProprietaryType = u8;
|
||||||
/// structure according to BIP 174.
|
/// structure according to BIP 174.
|
||||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
|
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
|
|
||||||
pub struct ProprietaryKey<Subtype = ProprietaryType>
|
pub struct ProprietaryKey<Subtype = ProprietaryType>
|
||||||
where
|
where
|
||||||
Subtype: Copy + From<u8> + Into<u8>,
|
Subtype: Copy + From<u8> + Into<u8>,
|
||||||
|
|
|
@ -166,7 +166,6 @@ pub mod btreemap_as_seq_byte_values {
|
||||||
|
|
||||||
/// A custom key-value pair type that serialized the bytes as hex.
|
/// A custom key-value pair type that serialized the bytes as hex.
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
#[serde(crate = "actual_serde")]
|
|
||||||
struct OwnedPair<T>(
|
struct OwnedPair<T>(
|
||||||
T,
|
T,
|
||||||
#[serde(deserialize_with = "crate::serde_utils::hex_bytes::deserialize")] Vec<u8>,
|
#[serde(deserialize_with = "crate::serde_utils::hex_bytes::deserialize")] Vec<u8>,
|
||||||
|
@ -174,7 +173,6 @@ pub mod btreemap_as_seq_byte_values {
|
||||||
|
|
||||||
/// A custom key-value pair type that serialized the bytes as hex.
|
/// A custom key-value pair type that serialized the bytes as hex.
|
||||||
#[derive(Debug, Serialize)]
|
#[derive(Debug, Serialize)]
|
||||||
#[serde(crate = "actual_serde")]
|
|
||||||
struct BorrowedPair<'a, T: 'static>(
|
struct BorrowedPair<'a, T: 'static>(
|
||||||
&'a T,
|
&'a T,
|
||||||
#[serde(serialize_with = "crate::serde_utils::hex_bytes::serialize")] &'a [u8],
|
#[serde(serialize_with = "crate::serde_utils::hex_bytes::serialize")] &'a [u8],
|
||||||
|
|
|
@ -13,7 +13,6 @@ use crate::prelude::{Borrow, BorrowMut, Box, Vec};
|
||||||
/// The Merkle proof for inclusion of a tree in a Taproot tree hash.
|
/// The Merkle proof for inclusion of a tree in a Taproot tree hash.
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
|
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
|
|
||||||
#[cfg_attr(feature = "serde", serde(into = "Vec<TapNodeHash>"))]
|
#[cfg_attr(feature = "serde", serde(into = "Vec<TapNodeHash>"))]
|
||||||
#[cfg_attr(feature = "serde", serde(try_from = "Vec<TapNodeHash>"))]
|
#[cfg_attr(feature = "serde", serde(try_from = "Vec<TapNodeHash>"))]
|
||||||
pub struct TaprootMerkleBranch(Vec<TapNodeHash>);
|
pub struct TaprootMerkleBranch(Vec<TapNodeHash>);
|
||||||
|
|
|
@ -692,7 +692,6 @@ impl std::error::Error for HiddenNodesError {
|
||||||
// for which we need a separate type.
|
// for which we need a separate type.
|
||||||
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
|
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
|
|
||||||
#[cfg_attr(feature = "serde", serde(into = "NodeInfo"))]
|
#[cfg_attr(feature = "serde", serde(into = "NodeInfo"))]
|
||||||
#[cfg_attr(feature = "serde", serde(try_from = "NodeInfo"))]
|
#[cfg_attr(feature = "serde", serde(try_from = "NodeInfo"))]
|
||||||
pub struct TapTree(NodeInfo);
|
pub struct TapTree(NodeInfo);
|
||||||
|
@ -952,7 +951,6 @@ impl<'de> serde::Deserialize<'de> for NodeInfo {
|
||||||
/// Leaf node in a Taproot tree. Can be either hidden or known.
|
/// Leaf node in a Taproot tree. Can be either hidden or known.
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
|
|
||||||
pub enum TapLeaf {
|
pub enum TapLeaf {
|
||||||
/// A known script
|
/// A known script
|
||||||
Script(ScriptBuf, LeafVersion),
|
Script(ScriptBuf, LeafVersion),
|
||||||
|
@ -1081,7 +1079,6 @@ impl<'leaf> ScriptLeaf<'leaf> {
|
||||||
/// Control block data structure used in Tapscript satisfaction.
|
/// Control block data structure used in Tapscript satisfaction.
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
|
|
||||||
pub struct ControlBlock {
|
pub struct ControlBlock {
|
||||||
/// The tapleaf version.
|
/// The tapleaf version.
|
||||||
pub leaf_version: LeafVersion,
|
pub leaf_version: LeafVersion,
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
msrv = "1.56.1"
|
msrv = "1.63.0"
|
||||||
too-many-arguments-threshold = 13
|
too-many-arguments-threshold = 13
|
||||||
|
|
|
@ -13,7 +13,7 @@ cat > "$REPO_DIR/fuzz/Cargo.toml" <<EOF
|
||||||
[package]
|
[package]
|
||||||
name = "bitcoin-fuzz"
|
name = "bitcoin-fuzz"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.56.1"
|
rust-version = "1.63.0"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
authors = ["Generated by fuzz/generate-files.sh"]
|
authors = ["Generated by fuzz/generate-files.sh"]
|
||||||
publish = false
|
publish = false
|
||||||
|
|
|
@ -10,7 +10,7 @@ categories = ["algorithms"]
|
||||||
keywords = [ "crypto", "bitcoin", "hash", "digest" ]
|
keywords = [ "crypto", "bitcoin", "hash", "digest" ]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.56.1"
|
rust-version = "1.63.0"
|
||||||
exclude = ["tests", "contrib"]
|
exclude = ["tests", "contrib"]
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
|
|
@ -9,7 +9,7 @@ since these are needed to display hashes anway.
|
||||||
|
|
||||||
## Minimum Supported Rust Version (MSRV)
|
## Minimum Supported Rust Version (MSRV)
|
||||||
|
|
||||||
This library should always compile with any combination of features on **Rust 1.56.1**.
|
This library should always compile with any combination of features on **Rust 1.63.0**.
|
||||||
|
|
||||||
## Contributions
|
## Contributions
|
||||||
|
|
||||||
|
|
|
@ -36,22 +36,9 @@ impl<T: Tag> schemars::JsonSchema for Hash<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This impl, and the trait bound `(T,): Tag` below, are hacks to allow defining
|
|
||||||
// constfns on Hash<T> for a generic T. This trick was discovered by
|
|
||||||
// https://github.com/rust-lang/rust/issues/90912
|
|
||||||
//
|
|
||||||
// When we drop rustc 1.56.1 we will be able to remove this, which will be a
|
|
||||||
// technically breaking change but in practice probably fine to just drop.
|
|
||||||
impl<T> Tag for (T,)
|
|
||||||
where
|
|
||||||
T: Tag,
|
|
||||||
{
|
|
||||||
fn engine() -> sha256::HashEngine { T::engine() }
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<T> Hash<T>
|
impl<T> Hash<T>
|
||||||
where
|
where
|
||||||
(T,): Tag,
|
T: Tag,
|
||||||
{
|
{
|
||||||
const fn internal_new(arr: [u8; 32]) -> Self { Hash(arr, PhantomData) }
|
const fn internal_new(arr: [u8; 32]) -> Self { Hash(arr, PhantomData) }
|
||||||
|
|
||||||
|
@ -70,7 +57,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Constructs a new engine.
|
/// Constructs a new engine.
|
||||||
pub fn engine() -> HashEngine { <(T,)>::engine() }
|
pub fn engine() -> HashEngine { T::engine() }
|
||||||
|
|
||||||
/// Produces a hash from the current state of a given engine.
|
/// Produces a hash from the current state of a given engine.
|
||||||
pub fn from_engine(e: HashEngine) -> Hash<T> { from_engine(e) }
|
pub fn from_engine(e: HashEngine) -> Hash<T> { from_engine(e) }
|
||||||
|
@ -146,7 +133,7 @@ crate::internal_macros::hash_trait_impls!(256, false, T: Tag);
|
||||||
|
|
||||||
fn from_engine<T>(e: sha256::HashEngine) -> Hash<T>
|
fn from_engine<T>(e: sha256::HashEngine) -> Hash<T>
|
||||||
where
|
where
|
||||||
(T,): Tag,
|
T: Tag,
|
||||||
{
|
{
|
||||||
Hash::from_byte_array(sha256::Hash::from_engine(e).to_byte_array())
|
Hash::from_byte_array(sha256::Hash::from_engine(e).to_byte_array())
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ categories = ["cryptography::cryptocurrencies"]
|
||||||
keywords = ["internal"]
|
keywords = ["internal"]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.56.1"
|
rust-version = "1.63.0"
|
||||||
exclude = ["tests", "contrib"]
|
exclude = ["tests", "contrib"]
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
|
|
@ -10,7 +10,7 @@ categories = ["no-std"]
|
||||||
keywords = [ "io", "no-std" ]
|
keywords = [ "io", "no-std" ]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.56.1"
|
rust-version = "1.63.0"
|
||||||
exclude = ["tests", "contrib"]
|
exclude = ["tests", "contrib"]
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
|
|
@ -11,14 +11,14 @@ categories = ["cryptography::cryptocurrencies"]
|
||||||
keywords = ["bitcoin", "types"]
|
keywords = ["bitcoin", "types"]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.56.1"
|
rust-version = "1.63.0"
|
||||||
exclude = ["tests", "contrib"]
|
exclude = ["tests", "contrib"]
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["std"]
|
default = ["std"]
|
||||||
std = ["alloc", "internals/std", "io/std", "units/std"]
|
std = ["alloc", "internals/std", "io/std", "units/std"]
|
||||||
alloc = ["internals/alloc", "io/alloc", "units/alloc"]
|
alloc = ["internals/alloc", "io/alloc", "units/alloc"]
|
||||||
serde = ["actual-serde", "internals/serde", "units/serde"]
|
serde = ["dep:serde", "internals/serde", "units/serde"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
internals = { package = "bitcoin-internals", version = "0.3.0" }
|
internals = { package = "bitcoin-internals", version = "0.3.0" }
|
||||||
|
@ -27,8 +27,7 @@ units = { package = "bitcoin-units", version = "0.1.0", default-features = false
|
||||||
|
|
||||||
ordered = { version = "0.2.0", optional = true }
|
ordered = { version = "0.2.0", optional = true }
|
||||||
|
|
||||||
# Do NOT use this as a feature! Use the `serde` feature instead.
|
serde = { version = "1.0.103", default-features = false, features = ["derive"], optional = true }
|
||||||
actual-serde = { package = "serde", version = "1.0.103", default-features = false, features = ["derive"], optional = true }
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ This crate provides primitive data types that are used throughout the
|
||||||
|
|
||||||
## Minimum Supported Rust Version (MSRV)
|
## Minimum Supported Rust Version (MSRV)
|
||||||
|
|
||||||
This library should always compile with any combination of features on **Rust 1.56.1**.
|
This library should always compile with any combination of features on **Rust 1.63.0**.
|
||||||
|
|
||||||
## Licensing
|
## Licensing
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ extern crate std;
|
||||||
|
|
||||||
#[cfg(feature = "serde")]
|
#[cfg(feature = "serde")]
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate actual_serde as serde;
|
extern crate serde;
|
||||||
|
|
||||||
#[cfg(feature = "alloc")]
|
#[cfg(feature = "alloc")]
|
||||||
pub mod locktime;
|
pub mod locktime;
|
||||||
|
|
|
@ -37,7 +37,6 @@ pub use units::locktime::relative::*;
|
||||||
/// * [BIP 112 CHECKSEQUENCEVERIFY](https://github.com/bitcoin/bips/blob/master/bip-0112.mediawiki)
|
/// * [BIP 112 CHECKSEQUENCEVERIFY](https://github.com/bitcoin/bips/blob/master/bip-0112.mediawiki)
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
|
|
||||||
pub enum LockTime {
|
pub enum LockTime {
|
||||||
/// A block height lock time value.
|
/// A block height lock time value.
|
||||||
Blocks(Height),
|
Blocks(Height),
|
||||||
|
|
|
@ -30,7 +30,6 @@ use crate::locktime::relative;
|
||||||
/// Bitcoin transaction input sequence number.
|
/// Bitcoin transaction input sequence number.
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
|
|
||||||
pub struct Sequence(pub u32);
|
pub struct Sequence(pub u32);
|
||||||
|
|
||||||
impl Sequence {
|
impl Sequence {
|
||||||
|
|
|
@ -9,7 +9,7 @@ categories = ["cryptography::cryptocurrencies"]
|
||||||
keywords = ["bitcoin", "newtypes"]
|
keywords = ["bitcoin", "newtypes"]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = "1.56.1"
|
rust-version = "1.63.0"
|
||||||
exclude = ["tests", "contrib"]
|
exclude = ["tests", "contrib"]
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
|
|
@ -4,7 +4,7 @@ This crate provides basic Bitcoin numeric units such as `Amount`.
|
||||||
|
|
||||||
## Minimum Supported Rust Version (MSRV)
|
## Minimum Supported Rust Version (MSRV)
|
||||||
|
|
||||||
This library should always compile with any combination of features on **Rust 1.56.1**.
|
This library should always compile with any combination of features on **Rust 1.63.0**.
|
||||||
|
|
||||||
## Licensing
|
## Licensing
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue