From 80e2e128ba53b52b6de87d2966bcf5da92856789 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Mon, 4 Sep 2023 17:36:10 +0200 Subject: [PATCH] Fix UNLOCK_INDEX_MAX (#1121) * Fix UNLOCK_INDEX_MAX * Update sdk/src/types/block/unlock/mod.rs Co-authored-by: Thoralf-M <46689931+Thoralf-M@users.noreply.github.com> --------- Co-authored-by: Thoralf-M <46689931+Thoralf-M@users.noreply.github.com> --- sdk/src/types/block/unlock/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sdk/src/types/block/unlock/mod.rs b/sdk/src/types/block/unlock/mod.rs index 232a60ff53..bbd74b8f56 100644 --- a/sdk/src/types/block/unlock/mod.rs +++ b/sdk/src/types/block/unlock/mod.rs @@ -15,7 +15,7 @@ use packable::{bounded::BoundedU16, prefix::BoxedSlicePrefix, Packable}; pub use self::{account::AccountUnlock, nft::NftUnlock, reference::ReferenceUnlock, signature::SignatureUnlock}; use crate::types::block::{ - input::{INPUT_COUNT_MAX, INPUT_COUNT_RANGE, INPUT_INDEX_MAX, INPUT_INDEX_RANGE}, + input::{INPUT_COUNT_MAX, INPUT_COUNT_RANGE, INPUT_INDEX_MAX}, Error, }; @@ -24,9 +24,9 @@ pub const UNLOCK_COUNT_MAX: u16 = INPUT_COUNT_MAX; // 128 /// The range of valid numbers of unlocks of a transaction. pub const UNLOCK_COUNT_RANGE: RangeInclusive = INPUT_COUNT_RANGE; // [1..128] /// The maximum index of unlocks of a transaction. -pub const UNLOCK_INDEX_MAX: u16 = INPUT_INDEX_MAX; // 127 -/// The range of valid indices of unlocks of a transaction. -pub const UNLOCK_INDEX_RANGE: RangeInclusive = INPUT_INDEX_RANGE; // [0..127] +pub const UNLOCK_INDEX_MAX: u16 = INPUT_INDEX_MAX - 1; // 126 +/// The range of valid indices of unlocks of a transaction that can be referenced in Reference, Alias or NFT unlocks. +pub const UNLOCK_INDEX_RANGE: RangeInclusive = 0..=UNLOCK_INDEX_MAX; // [0..126] pub(crate) type UnlockIndex = BoundedU16<{ *UNLOCK_INDEX_RANGE.start() }, { *UNLOCK_INDEX_RANGE.end() }>;