add conversions from TXIDs to merkle nodes

This commit is contained in:
conduition 2023-11-27 00:12:16 +00:00
parent cfa6768e79
commit 32eb461523
1 changed files with 13 additions and 1 deletions

View File

@ -65,7 +65,7 @@ mod newtypes {
/// 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.
pub struct Txid(sha256d::Hash);
pub struct Txid(sha256d::Hash);
/// A bitcoin witness transaction ID.
pub struct Wtxid(sha256d::Hash);
@ -94,4 +94,16 @@ mod newtypes {
impl_hashencode!(FilterHash);
impl_hashencode!(FilterHeader);
impl From<Txid> for TxMerkleNode {
fn from(txid: Txid) -> Self {
Self::from(txid.0)
}
}
impl From<Wtxid> for WitnessMerkleNode {
fn from(wtxid: Wtxid) -> Self {
Self::from(wtxid.0)
}
}
}