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

Allow ImplicitAccountCreationAddress unlocking #1597

Merged
Show file tree
Hide file tree
Changes from 3 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 sdk/src/types/block/address/implicit_account_creation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::types::block::address::Ed25519Address;
/// [`AccountOutput`](crate::types::block::output::AccountOutput).
#[derive(Copy, Clone, Display, Eq, PartialEq, Ord, PartialOrd, Hash, FromStr, AsRef, Deref, From, Packable)]
#[as_ref(forward)]
pub struct ImplicitAccountCreationAddress(Ed25519Address);
pub struct ImplicitAccountCreationAddress(pub(crate) Ed25519Address);
DaughterOfMars marked this conversation as resolved.
Show resolved Hide resolved

impl ImplicitAccountCreationAddress {
/// The [`Address`](crate::types::block::address::Address) kind of an [`ImplicitAccountCreationAddress`].
Expand Down
5 changes: 4 additions & 1 deletion sdk/src/types/block/address/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ impl Address {

context.unlocked_addresses.insert(self.clone());
}
(Self::Ed25519(_ed25519_address), Unlock::Reference(_unlock)) => {
(Self::Ed25519(_), Unlock::Reference(_)) => {
// TODO actually check that it was unlocked by the same signature.
if !context.unlocked_addresses.contains(self) {
return Err(TransactionFailureReason::InvalidInputUnlock);
Expand Down Expand Up @@ -168,6 +168,9 @@ impl Address {
}
// TODO maybe shouldn't be a semantic error but this function currently returns a TransactionFailureReason.
(Self::Anchor(_), _) => return Err(TransactionFailureReason::SemanticValidationFailed),
(Self::ImplicitAccountCreation(ImplicitAccountCreationAddress(ed25519_address)), _) => {
Address::from(ed25519_address.clone()).unlock(unlock, context)?;
Thoralf-M marked this conversation as resolved.
Show resolved Hide resolved
thibault-martinez marked this conversation as resolved.
Show resolved Hide resolved
}
_ => return Err(TransactionFailureReason::InvalidInputUnlock),
}

Expand Down
Loading