Skip to content

Commit

Permalink
Use ALL_FLAGS length instead of constant (#1684)
Browse files Browse the repository at this point in the history
  • Loading branch information
thibault-martinez authored Nov 27, 2023
1 parent 0a89370 commit 65aacac
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
5 changes: 1 addition & 4 deletions sdk/src/types/block/output/feature/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ crate::create_bitflags!(
]
);

pub(crate) type FeatureCount = BoundedU8<0, { Features::COUNT_MAX }>;
pub(crate) type FeatureCount = BoundedU8<0, { FeatureFlags::ALL_FLAGS.len() as u8 }>;

///
#[derive(Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Deref, Packable)]
Expand Down Expand Up @@ -199,9 +199,6 @@ impl IntoIterator for Features {
}

impl Features {
///
pub const COUNT_MAX: u8 = 5;

/// Creates a new [`Features`] from a vec.
pub fn from_vec(features: Vec<Feature>) -> Result<Self, Error> {
let mut features = BoxedSlicePrefix::<Feature, FeatureCount>::try_from(features.into_boxed_slice())
Expand Down
5 changes: 1 addition & 4 deletions sdk/src/types/block/output/unlock_condition/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ crate::create_bitflags!(
]
);

pub(crate) type UnlockConditionCount = BoundedU8<0, { UnlockConditions::COUNT_MAX }>;
pub(crate) type UnlockConditionCount = BoundedU8<0, { UnlockConditionFlags::ALL_FLAGS.len() as u8 }>;

///
#[derive(Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Deref, Packable)]
Expand Down Expand Up @@ -193,9 +193,6 @@ impl IntoIterator for UnlockConditions {
}

impl UnlockConditions {
///
pub const COUNT_MAX: u8 = 7;

/// Creates a new [`UnlockConditions`] from a vec.
pub fn from_vec(unlock_conditions: Vec<UnlockCondition>) -> Result<Self, Error> {
let mut unlock_conditions =
Expand Down

0 comments on commit 65aacac

Please sign in to comment.