From 36529629bc60b138d7eff1f844b6fe804164e334 Mon Sep 17 00:00:00 2001 From: Kris Nuttycombe Date: Fri, 23 Apr 2021 13:04:45 -0600 Subject: [PATCH] Expose Flags constructor & accessors. --- src/bundle.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/bundle.rs b/src/bundle.rs index 96964a02..c9aa4456 100644 --- a/src/bundle.rs +++ b/src/bundle.rs @@ -126,6 +126,31 @@ pub struct Flags { outputs_enabled: bool, } +impl Flags { + /// Construct a set of flags from its constituent parts + pub fn from_parts(spends_enabled: bool, outputs_enabled: bool) -> Self { + Flags { spends_enabled, outputs_enabled } + } + + /// Flag denoting whether Orchard spends are enabled in the transaction. + /// + /// If `true`, spent notes within [`Action`]s in the transaction's [`Bundle`] are + /// guaranteed to be dummy notes. If `false`, the spent notes may be either real or + /// dummy notes. + pub fn spends_enabled(&self) -> bool { + self.spends_enabled + } + + /// Flag denoting whether Orchard outputs are enabled in the transaction. + /// + /// If `true`, created notes within [`Action`]s in the transaction's [`Bundle`] are + /// guaranteed to be dummy notes. If `false`, the created notes may be either real or + /// dummy notes. + pub fn outputs_enabled(&self) -> bool { + self.outputs_enabled + } +} + /// Defines the authorization type of an Orchard bundle. pub trait Authorization { /// The authorization type of an Orchard action.