Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix return type of ImmutableAliasAddressUnlockCondition::address #1416

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bee-block/src/output/foundry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ impl FoundryOutput {
// A FoundryOutput must have an ImmutableAliasAddressUnlockCondition.
self.unlock_conditions
.immutable_alias_address()
.map(|unlock_condition| unlock_condition.address())
.map(|unlock_condition| unlock_condition.alias_address())
.unwrap()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,17 @@ impl ImmutableAliasAddressUnlockCondition {
Self(Address::Alias(address))
}

/// Returns the address of a [`ImmutableAliasAddressUnlockCondition`].
/// Returns the address of an [`ImmutableAliasAddressUnlockCondition`].
#[inline(always)]
pub fn address(&self) -> &AliasAddress {
pub fn address(&self) -> &Address {
// An ImmutableAliasAddressUnlockCondition must have an AliasAddress.
// It has already been validated at construction that the address is an `AliasAddress`.
debug_assert!(&self.0.is_alias());
&self.0
}

/// Returns the alias address of an [`ImmutableAliasAddressUnlockCondition`].
pub fn alias_address(&self) -> &AliasAddress {
// An ImmutableAliasAddressUnlockCondition must have an AliasAddress.
if let Address::Alias(alias_address) = &self.0 {
alias_address
Expand Down
2 changes: 1 addition & 1 deletion bee-block/src/output/unlock_condition/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ pub mod dto {
UnlockCondition::ImmutableAliasAddress(v) => {
Self::ImmutableAliasAddress(ImmutableAliasAddressUnlockConditionDto {
kind: ImmutableAliasAddressUnlockCondition::KIND,
address: AddressDto::Alias(v.address().into()),
address: v.address().into(),
})
}
}
Expand Down