Merge rust-bitcoin/rust-bitcoin#1006: Feature `use-serde` renamed to `serde`
2e7effc604
Feature `use-serde` renamed to `serde` (Martin Habovstiak) Pull request description: Features activating external crates are supposed to have same name as those crates. However we depend on same feature in other crates so we need a separate feature. After MSRV bump it is possible to rename the crates and features so we can now fix this inconsistency. Sadly, derive can't see that the crate was renamed so all derives must be told to use the other one. Replaces #373 ACKs for top commit: apoelstra: ACK2e7effc604
Tree-SHA512: b20364b9e8f30c2269bef915e821b2b2ec929e71dd0e88af2bc3a021821f87011d35e095cb8efe99add77a23dde940a17537eb387fb4582b05c57c8679969eb0
This commit is contained in:
commit
471f90923d
|
@ -17,7 +17,7 @@ edition = "2018"
|
||||||
default = [ "std", "secp-recovery" ]
|
default = [ "std", "secp-recovery" ]
|
||||||
unstable = []
|
unstable = []
|
||||||
rand = ["secp256k1/rand-std"]
|
rand = ["secp256k1/rand-std"]
|
||||||
use-serde = ["serde", "bitcoin_hashes/serde", "secp256k1/serde"]
|
serde = ["actual-serde", "bitcoin_hashes/serde", "secp256k1/serde"]
|
||||||
secp-lowmemory = ["secp256k1/lowmemory"]
|
secp-lowmemory = ["secp256k1/lowmemory"]
|
||||||
secp-recovery = ["secp256k1/recovery"]
|
secp-recovery = ["secp256k1/recovery"]
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ std = ["secp256k1/std", "bitcoin_hashes/std", "bech32/std"]
|
||||||
no-std = ["hashbrown", "core2/alloc", "bitcoin_hashes/alloc", "secp256k1/alloc"]
|
no-std = ["hashbrown", "core2/alloc", "bitcoin_hashes/alloc", "secp256k1/alloc"]
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
features = [ "std", "secp-recovery", "base64", "rand", "use-serde", "bitcoinconsensus" ]
|
features = [ "std", "secp-recovery", "base64", "rand", "serde", "bitcoinconsensus" ]
|
||||||
rustdoc-args = ["--cfg", "docsrs"]
|
rustdoc-args = ["--cfg", "docsrs"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
@ -41,7 +41,8 @@ core2 = { version = "0.3.0", optional = true, default-features = false }
|
||||||
|
|
||||||
base64 = { version = "0.13.0", optional = true }
|
base64 = { version = "0.13.0", optional = true }
|
||||||
bitcoinconsensus = { version = "0.19.0-3", optional = true }
|
bitcoinconsensus = { version = "0.19.0-3", optional = true }
|
||||||
serde = { version = "1", default-features = false, features = [ "derive", "alloc" ], optional = true }
|
# Do NOT use this as a feature! Use the `serde` feature instead.
|
||||||
|
actual-serde = { package = "serde", version = "1", default-features = false, features = [ "derive", "alloc" ], optional = true }
|
||||||
hashbrown = { version = "0.8", optional = true }
|
hashbrown = { version = "0.8", optional = true }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh -ex
|
#!/bin/sh -ex
|
||||||
|
|
||||||
FEATURES="base64 bitcoinconsensus use-serde rand secp-recovery"
|
FEATURES="base64 bitcoinconsensus serde rand secp-recovery"
|
||||||
|
|
||||||
# Use toolchain if explicitly specified
|
# Use toolchain if explicitly specified
|
||||||
if [ -n "$TOOLCHAIN" ]
|
if [ -n "$TOOLCHAIN" ]
|
||||||
|
@ -80,7 +80,7 @@ if [ "$AS_DEPENDENCY" = true ]
|
||||||
then
|
then
|
||||||
cargo new dep_test
|
cargo new dep_test
|
||||||
cd dep_test
|
cd dep_test
|
||||||
echo 'bitcoin = { path = "..", features = ["use-serde"] }' >> Cargo.toml
|
echo 'bitcoin = { path = "..", features = ["serde"] }' >> Cargo.toml
|
||||||
|
|
||||||
cargo test --verbose
|
cargo test --verbose
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -41,6 +41,7 @@ use crate::VarInt;
|
||||||
/// the actual transactions
|
/// the actual transactions
|
||||||
#[derive(Copy, PartialEq, Eq, Clone, Debug)]
|
#[derive(Copy, 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 BlockHeader {
|
pub struct BlockHeader {
|
||||||
/// The protocol version. Should always be 1.
|
/// The protocol version. Should always be 1.
|
||||||
pub version: i32,
|
pub version: i32,
|
||||||
|
@ -159,6 +160,7 @@ impl BlockHeader {
|
||||||
/// proof of work.
|
/// proof of work.
|
||||||
#[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: BlockHeader,
|
pub header: BlockHeader,
|
||||||
|
|
|
@ -191,6 +191,7 @@ impl ::core::str::FromStr for OutPoint {
|
||||||
/// A transaction input, which defines old coins to be consumed
|
/// A transaction input, which defines old coins to be consumed
|
||||||
#[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 an an input.
|
/// The reference to the previous output that is being used an an input.
|
||||||
pub previous_output: OutPoint,
|
pub previous_output: OutPoint,
|
||||||
|
@ -224,6 +225,7 @@ impl Default for TxIn {
|
||||||
/// A transaction output, which defines new coins to be created from old ones.
|
/// A transaction output, which defines new coins to be created from old ones.
|
||||||
#[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: u64,
|
pub value: u64,
|
||||||
|
@ -270,6 +272,7 @@ impl Default for TxOut {
|
||||||
/// for 0-input transactions, which results in unambiguously parseable transactions.
|
/// for 0-input transactions, which results in unambiguously parseable transactions.
|
||||||
#[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 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: i32,
|
pub version: i32,
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
//! * `base64` - (dependency), enables encoding of PSBTs and message signatures.
|
//! * `base64` - (dependency), enables encoding of PSBTs and message signatures.
|
||||||
//! * `unstable` - enables unstable features for testing.
|
//! * `unstable` - enables unstable features for testing.
|
||||||
//! * `rand` - (dependency), makes it more convenient to generate random values.
|
//! * `rand` - (dependency), makes it more convenient to generate random values.
|
||||||
//! * `use-serde` - (dependency), implements `serde`-based serialization and
|
//! * `serde` - (dependency), implements `serde`-based serialization and
|
||||||
//! deserialization.
|
//! deserialization.
|
||||||
//! * `secp-lowmemory` - optimizations for low-memory devices.
|
//! * `secp-lowmemory` - optimizations for low-memory devices.
|
||||||
//! * `no-std` - enables additional features required for this crate to be usable
|
//! * `no-std` - enables additional features required for this crate to be usable
|
||||||
|
@ -90,7 +90,7 @@ extern crate hashbrown;
|
||||||
pub extern crate base64;
|
pub extern crate base64;
|
||||||
|
|
||||||
#[cfg(feature="bitcoinconsensus")] extern crate bitcoinconsensus;
|
#[cfg(feature="bitcoinconsensus")] extern crate bitcoinconsensus;
|
||||||
#[cfg(feature = "serde")] #[macro_use] extern crate serde;
|
#[cfg(feature = "serde")] #[macro_use] extern crate actual_serde as serde;
|
||||||
#[cfg(all(test, feature = "serde"))] extern crate serde_json;
|
#[cfg(all(test, feature = "serde"))] extern crate serde_json;
|
||||||
#[cfg(all(test, feature = "serde"))] extern crate serde_test;
|
#[cfg(all(test, feature = "serde"))] extern crate serde_test;
|
||||||
#[cfg(all(test, feature = "serde"))] extern crate bincode;
|
#[cfg(all(test, feature = "serde"))] extern crate bincode;
|
||||||
|
|
|
@ -152,6 +152,7 @@ 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")]
|
#[serde(deserialize_with = "crate::serde_utils::hex_bytes::deserialize")]
|
||||||
|
@ -160,6 +161,7 @@ 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")]
|
#[serde(serialize_with = "crate::serde_utils::hex_bytes::serialize")]
|
||||||
|
|
|
@ -1262,6 +1262,7 @@ pub mod serde {
|
||||||
//! use bitcoin::Amount;
|
//! use bitcoin::Amount;
|
||||||
//!
|
//!
|
||||||
//! #[derive(Serialize, Deserialize)]
|
//! #[derive(Serialize, Deserialize)]
|
||||||
|
//! # #[serde(crate = "actual_serde")]
|
||||||
//! pub struct HasAmount {
|
//! pub struct HasAmount {
|
||||||
//! #[serde(with = "bitcoin::util::amount::serde::as_btc")]
|
//! #[serde(with = "bitcoin::util::amount::serde::as_btc")]
|
||||||
//! pub amount: Amount,
|
//! pub amount: Amount,
|
||||||
|
@ -1976,6 +1977,7 @@ mod tests {
|
||||||
fn serde_as_sat() {
|
fn serde_as_sat() {
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, PartialEq, Debug)]
|
#[derive(Serialize, Deserialize, PartialEq, Debug)]
|
||||||
|
#[serde(crate = "actual_serde")]
|
||||||
struct T {
|
struct T {
|
||||||
#[serde(with = "crate::util::amount::serde::as_sat")]
|
#[serde(with = "crate::util::amount::serde::as_sat")]
|
||||||
pub amt: Amount,
|
pub amt: Amount,
|
||||||
|
@ -2005,6 +2007,7 @@ mod tests {
|
||||||
use serde_json;
|
use serde_json;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, PartialEq, Debug)]
|
#[derive(Serialize, Deserialize, PartialEq, Debug)]
|
||||||
|
#[serde(crate = "actual_serde")]
|
||||||
struct T {
|
struct T {
|
||||||
#[serde(with = "crate::util::amount::serde::as_btc")]
|
#[serde(with = "crate::util::amount::serde::as_btc")]
|
||||||
pub amt: Amount,
|
pub amt: Amount,
|
||||||
|
@ -2039,6 +2042,7 @@ mod tests {
|
||||||
use serde_json;
|
use serde_json;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, PartialEq, Debug, Eq)]
|
#[derive(Serialize, Deserialize, PartialEq, Debug, Eq)]
|
||||||
|
#[serde(crate = "actual_serde")]
|
||||||
struct T {
|
struct T {
|
||||||
#[serde(default, with = "crate::util::amount::serde::as_btc::opt")]
|
#[serde(default, with = "crate::util::amount::serde::as_btc::opt")]
|
||||||
pub amt: Option<Amount>,
|
pub amt: Option<Amount>,
|
||||||
|
@ -2082,6 +2086,7 @@ mod tests {
|
||||||
use serde_json;
|
use serde_json;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, PartialEq, Debug, Eq)]
|
#[derive(Serialize, Deserialize, PartialEq, Debug, Eq)]
|
||||||
|
#[serde(crate = "actual_serde")]
|
||||||
struct T {
|
struct T {
|
||||||
#[serde(default, with = "crate::util::amount::serde::as_sat::opt")]
|
#[serde(default, with = "crate::util::amount::serde::as_sat::opt")]
|
||||||
pub amt: Option<Amount>,
|
pub amt: Option<Amount>,
|
||||||
|
|
|
@ -27,6 +27,7 @@ use crate::EcdsaSighashType;
|
||||||
/// An ECDSA signature with the corresponding hash type.
|
/// An ECDSA signature with the corresponding hash type.
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
#[derive(Debug, Copy, Clone, 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 EcdsaSig {
|
pub struct EcdsaSig {
|
||||||
/// The underlying ECDSA Signature
|
/// The underlying ECDSA Signature
|
||||||
pub sig: secp256k1::ecdsa::Signature,
|
pub sig: secp256k1::ecdsa::Signature,
|
||||||
|
|
|
@ -81,6 +81,7 @@ const PSBT_IN_PROPRIETARY: u8 = 0xFC;
|
||||||
/// transaction.
|
/// transaction.
|
||||||
#[derive(Clone, Default, Debug, PartialEq, Eq)]
|
#[derive(Clone, Default, 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 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
|
||||||
/// [std::option::Option::Some] for inputs which spend non-segwit outputs or
|
/// [std::option::Option::Some] for inputs which spend non-segwit outputs or
|
||||||
|
@ -153,6 +154,7 @@ pub struct Input {
|
||||||
/// for converting to/from [`PsbtSighashType`] from/to the desired signature hash type they need.
|
/// for converting to/from [`PsbtSighashType`] from/to the desired signature hash type they need.
|
||||||
#[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::util::psbt) inner: u32,
|
pub (in crate::util::psbt) inner: u32,
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,7 @@ const PSBT_OUT_PROPRIETARY: u8 = 0xFC;
|
||||||
/// transaction.
|
/// transaction.
|
||||||
#[derive(Clone, Default, Debug, PartialEq, Eq)]
|
#[derive(Clone, Default, 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 Output {
|
pub struct Output {
|
||||||
/// The redeem script for this output.
|
/// The redeem script for this output.
|
||||||
pub redeem_script: Option<Script>,
|
pub redeem_script: Option<Script>,
|
||||||
|
@ -124,6 +125,7 @@ impl std::error::Error for IncompleteTapTree {
|
||||||
/// Taproot Tree representing a finalized [`TaprootBuilder`] (a complete binary tree).
|
/// Taproot Tree representing a finalized [`TaprootBuilder`] (a complete binary tree).
|
||||||
#[derive(Clone, Debug)]
|
#[derive(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 TapTree(pub(crate) TaprootBuilder);
|
pub struct TapTree(pub(crate) TaprootBuilder);
|
||||||
|
|
||||||
impl PartialEq for TapTree {
|
impl PartialEq for TapTree {
|
||||||
|
|
|
@ -52,6 +52,7 @@ pub type Psbt = PartiallySignedTransaction;
|
||||||
/// A Partially Signed Transaction.
|
/// A Partially Signed Transaction.
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, 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 PartiallySignedTransaction {
|
pub struct PartiallySignedTransaction {
|
||||||
/// 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,
|
||||||
|
|
|
@ -30,6 +30,7 @@ use crate::util::read_to_end;
|
||||||
/// A PSBT key in its raw byte form.
|
/// A PSBT key in its raw byte form.
|
||||||
#[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,
|
||||||
|
@ -41,6 +42,7 @@ pub struct Key {
|
||||||
/// A PSBT key-value pair in its raw byte form.
|
/// A PSBT key-value pair in its raw byte form.
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
#[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,
|
||||||
|
@ -56,6 +58,7 @@ 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> where Subtype: Copy + From<u8> + Into<u8> {
|
pub struct ProprietaryKey<Subtype=ProprietaryType> where Subtype: Copy + From<u8> + Into<u8> {
|
||||||
/// Proprietary type prefix used for grouping together keys under some
|
/// Proprietary type prefix used for grouping together keys under some
|
||||||
/// application and avoid namespace collision
|
/// application and avoid namespace collision
|
||||||
|
|
|
@ -39,6 +39,7 @@ pub type UntweakedPublicKey = crate::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(crate::XOnlyPublicKey);
|
pub struct TweakedPublicKey(crate::XOnlyPublicKey);
|
||||||
|
|
||||||
|
@ -60,6 +61,7 @@ pub type UntweakedKeyPair = crate::KeyPair;
|
||||||
/// Tweaked BIP-340 key pair
|
/// Tweaked BIP-340 key pair
|
||||||
#[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(crate::KeyPair);
|
pub struct TweakedKeyPair(crate::KeyPair);
|
||||||
|
|
||||||
|
@ -216,6 +218,7 @@ impl From<TweakedKeyPair> for crate::KeyPair {
|
||||||
/// A BIP340-341 serialized schnorr signature with the corresponding hash type.
|
/// A BIP340-341 serialized schnorr signature with the corresponding hash type.
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
|
||||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||||
|
#[cfg_attr(feature = "serde", serde(crate = "actual_serde"))]
|
||||||
pub struct SchnorrSig {
|
pub struct SchnorrSig {
|
||||||
/// The underlying schnorr signature
|
/// The underlying schnorr signature
|
||||||
pub sig: secp256k1::schnorr::Signature,
|
pub sig: secp256k1::schnorr::Signature,
|
||||||
|
|
|
@ -166,6 +166,7 @@ type ScriptMerkleProofMap = BTreeMap<(Script, LeafVersion), BTreeSet<TaprootMerk
|
||||||
/// [annex](https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki#cite_note-5).
|
/// [annex](https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki#cite_note-5).
|
||||||
#[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 TaprootSpendInfo {
|
pub struct TaprootSpendInfo {
|
||||||
/// The BIP341 internal key.
|
/// The BIP341 internal key.
|
||||||
internal_key: UntweakedPublicKey,
|
internal_key: UntweakedPublicKey,
|
||||||
|
@ -314,6 +315,7 @@ impl TaprootSpendInfo {
|
||||||
// Similar to Taproot Builder in bitcoin core.
|
// Similar to Taproot Builder in bitcoin core.
|
||||||
#[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 TaprootBuilder {
|
pub struct TaprootBuilder {
|
||||||
// The following doc-comment is from bitcoin core, but modified for Rust. It describes the
|
// The following doc-comment is from bitcoin core, but modified for Rust. It describes the
|
||||||
// current state of the builder for a given tree.
|
// current state of the builder for a given tree.
|
||||||
|
@ -530,6 +532,7 @@ impl Default for TaprootBuilder {
|
||||||
/// root [`NodeInfo`].
|
/// root [`NodeInfo`].
|
||||||
#[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 NodeInfo {
|
pub struct NodeInfo {
|
||||||
/// Merkle hash for this node.
|
/// Merkle hash for this node.
|
||||||
pub(crate) hash: sha256::Hash,
|
pub(crate) hash: sha256::Hash,
|
||||||
|
@ -582,6 +585,7 @@ impl NodeInfo {
|
||||||
/// Store information about taproot leaf node.
|
/// Store information about taproot leaf node.
|
||||||
#[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 ScriptLeaf {
|
pub struct ScriptLeaf {
|
||||||
/// The underlying script.
|
/// The underlying script.
|
||||||
script: Script,
|
script: Script,
|
||||||
|
@ -640,6 +644,7 @@ impl ScriptLeaf {
|
||||||
// `TapLeafHash`.
|
// `TapLeafHash`.
|
||||||
#[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"))]
|
||||||
pub struct TaprootMerkleBranch(Vec<sha256::Hash>);
|
pub struct TaprootMerkleBranch(Vec<sha256::Hash>);
|
||||||
|
|
||||||
impl TaprootMerkleBranch {
|
impl TaprootMerkleBranch {
|
||||||
|
@ -716,6 +721,7 @@ impl TaprootMerkleBranch {
|
||||||
/// 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,
|
||||||
|
|
Loading…
Reference in New Issue