From d90f5774e3b8d41cb97bb2f1113d8c00351d2291 Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Sat, 20 Jan 2024 12:04:57 +0100 Subject: [PATCH] seals: add to_outpoint convertor method for seals with defined txid info --- seals/src/txout/blind.rs | 4 ++++ seals/src/txout/explicit.rs | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/seals/src/txout/blind.rs b/seals/src/txout/blind.rs index 3c0e45e4..9ed291db 100644 --- a/seals/src/txout/blind.rs +++ b/seals/src/txout/blind.rs @@ -233,6 +233,10 @@ impl BlindSeal { pub fn transmutate(self) -> BlindSeal { 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 BlindSeal { diff --git a/seals/src/txout/explicit.rs b/seals/src/txout/explicit.rs index 1b9b9540..92253010 100644 --- a/seals/src/txout/explicit.rs +++ b/seals/src/txout/explicit.rs @@ -132,6 +132,12 @@ impl ExplicitSeal { } } +impl ExplicitSeal { + /// 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)]