Define extension traits for txid types
Use the `define_extension_trait` macro to define two extension traits for the two txid types. Each trait holds the deprecated `all_zeros` function. There are no users of this trait in the code base.
This commit is contained in:
parent
832b726d03
commit
7e454d756d
|
@ -58,10 +58,15 @@ impl Txid {
|
||||||
/// This is used as the "txid" of the dummy input of a coinbase transaction. This is not a real
|
/// This is used as the "txid" of the dummy input of a coinbase transaction. This is not a real
|
||||||
/// TXID and should not be used in any other contexts. See [`OutPoint::COINBASE_PREVOUT`].
|
/// TXID and should not be used in any other contexts. See [`OutPoint::COINBASE_PREVOUT`].
|
||||||
pub const COINBASE_PREVOUT: Self = Self::from_byte_array([0; 32]);
|
pub const COINBASE_PREVOUT: Self = Self::from_byte_array([0; 32]);
|
||||||
|
}
|
||||||
|
|
||||||
/// The "all zeros" TXID.
|
crate::internal_macros::define_extension_trait! {
|
||||||
#[deprecated(since = "TBD", note = "use Txid::COINBASE_PREVOUT instead")]
|
/// Extension functionality for the [`Txid`] type.
|
||||||
pub fn all_zeros() -> Self { Self::COINBASE_PREVOUT }
|
pub trait TxidExt impl for Txid {
|
||||||
|
/// The "all zeros" TXID.
|
||||||
|
#[deprecated(since = "TBD", note = "use Txid::COINBASE_PREVOUT instead")]
|
||||||
|
fn all_zeros() -> Self { Self::COINBASE_PREVOUT }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Wtxid {
|
impl Wtxid {
|
||||||
|
@ -71,10 +76,15 @@ impl Wtxid {
|
||||||
/// witness commitment tree) since the coinbase transaction contains a commitment to all
|
/// witness commitment tree) since the coinbase transaction contains a commitment to all
|
||||||
/// transactions' wTXIDs but naturally cannot commit to its own.
|
/// transactions' wTXIDs but naturally cannot commit to its own.
|
||||||
pub const COINBASE: Self = Self::from_byte_array([0; 32]);
|
pub const COINBASE: Self = Self::from_byte_array([0; 32]);
|
||||||
|
}
|
||||||
|
|
||||||
/// The "all zeros" wTXID.
|
crate::internal_macros::define_extension_trait! {
|
||||||
#[deprecated(since = "TBD", note = "use Wtxid::COINBASE instead")]
|
/// Extension functionality for the [`Wtxid`] type.
|
||||||
pub fn all_zeros() -> Self { Self::COINBASE }
|
pub trait WtxidExt impl for Wtxid {
|
||||||
|
/// The "all zeros" wTXID.
|
||||||
|
#[deprecated(since = "TBD", note = "use Wtxid::COINBASE instead")]
|
||||||
|
fn all_zeros() -> Self { Self::COINBASE }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Trait that abstracts over a transaction identifier i.e., `Txid` and `Wtxid`.
|
/// Trait that abstracts over a transaction identifier i.e., `Txid` and `Wtxid`.
|
||||||
|
|
Loading…
Reference in New Issue