Skip to content

Commit

Permalink
seals: add to_outpoint convertor method for seals with defined txid info
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Jan 20, 2024
1 parent cbcaf16 commit d90f577
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions seals/src/txout/blind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@ impl<M: SealCloseMethod> BlindSeal<Txid, M> {
pub fn transmutate(self) -> BlindSeal<TxPtr, M> {
BlindSeal::with_blinding(self.method, self.txid, self.vout, self.blinding)
}

/// Converts seal into a transaction outpoint.
#[inline]
pub fn to_outpoint(&self) -> Outpoint { Outpoint::new(self.txid, self.vout) }
}

impl<M: SealCloseMethod> BlindSeal<TxPtr, M> {
Expand Down
6 changes: 6 additions & 0 deletions seals/src/txout/explicit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ impl<Id: SealTxid, M: SealCloseMethod> ExplicitSeal<Id, M> {
}
}

impl<M: SealCloseMethod> ExplicitSeal<Txid, M> {
/// Converts seal into a transaction outpoint.
#[inline]
pub fn to_outpoint(&self) -> Outpoint { Outpoint::new(self.txid, self.vout) }
}

/// Errors happening during parsing string representation of different forms of
/// single-use-seals
#[derive(Clone, PartialEq, Eq, Debug, Display, Error, From)]
Expand Down

0 comments on commit d90f577

Please sign in to comment.