pub struct Txid(/* private fields */);
Expand description
A bitcoin transaction hash/transaction ID.
For compatibility with the existing Bitcoin infrastructure and historical and current
versions of the Bitcoin Core software itself, this and other sha256d::Hash
types, are
serialized in reverse byte order when converted to a hex string via std::fmt::Display
trait operations.
See hashes::Hash::DISPLAY_BACKWARD
for more details.
Implementations§
Source§impl Txid
impl Txid
Sourcepub const fn from_byte_array(bytes: <Hash as Hash>::Bytes) -> Self
pub const fn from_byte_array(bytes: <Hash as Hash>::Bytes) -> Self
Constructs a hash from the underlying byte array.
Sourcepub fn from_slice(sl: &[u8]) -> Result<Txid, FromSliceError>
👎Deprecated since 0.15.0: use from_byte_array
instead
pub fn from_slice(sl: &[u8]) -> Result<Txid, FromSliceError>
from_byte_array
insteadCopies a byte slice into a hash object.
Sourcepub const fn to_byte_array(self) -> <Hash as Hash>::Bytes
pub const fn to_byte_array(self) -> <Hash as Hash>::Bytes
Returns the underlying byte array.
Sourcepub const fn as_byte_array(&self) -> &<Hash as Hash>::Bytes
pub const fn as_byte_array(&self) -> &<Hash as Hash>::Bytes
Returns a reference to the underlying byte array.
Source§impl Txid
impl Txid
Sourcepub const COINBASE_PREVOUT: Self
pub const COINBASE_PREVOUT: Self
The Txid
used in a coinbase prevout.
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
.
Trait Implementations§
Source§impl<'a> Arbitrary<'a> for Txid
Available on crate feature arbitrary
only.
impl<'a> Arbitrary<'a> for Txid
arbitrary
only.Source§fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<Self>
Self
from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self
from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured
this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured
this type
needs to construct itself. Read moreSource§impl<'de> Deserialize<'de> for Txid
impl<'de> Deserialize<'de> for Txid
Source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Txid, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Txid, D::Error>
Source§impl From<&Transaction> for Txid
Available on crate feature alloc
only.
impl From<&Transaction> for Txid
alloc
only.Source§fn from(tx: &Transaction) -> Txid
fn from(tx: &Transaction) -> Txid
Source§impl From<Transaction> for Txid
Available on crate feature alloc
only.
impl From<Transaction> for Txid
alloc
only.Source§fn from(tx: Transaction) -> Txid
fn from(tx: Transaction) -> Txid
Source§impl Hash for Txid
impl Hash for Txid
Source§const DISPLAY_BACKWARD: bool = true
const DISPLAY_BACKWARD: bool = true
Source§fn from_byte_array(bytes: Self::Bytes) -> Self
fn from_byte_array(bytes: Self::Bytes) -> Self
Source§fn from_slice(sl: &[u8]) -> Result<Txid, FromSliceError>
fn from_slice(sl: &[u8]) -> Result<Txid, FromSliceError>
from_byte_array
instead