Skip to content

Commit

Permalink
ISA: disallow unrequired implicit accounts from being selected (#1745)
Browse files Browse the repository at this point in the history
  • Loading branch information
thibault-martinez authored Dec 6, 2023
1 parent 6d3e4c9 commit dc7dfc2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions sdk/src/client/api/block_builder/input_selection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ use crate::{
};

/// Working state for the input selection algorithm.
#[derive(Debug)]
pub struct InputSelection {
available_inputs: Vec<InputSigningData>,
required_inputs: HashSet<OutputId>,
Expand Down Expand Up @@ -245,9 +246,12 @@ impl InputSelection {

match required_address {
Address::Anchor(_) => false,
Address::ImplicitAccountCreation(implicit_account_creation) => self
.addresses
.contains(&Address::from(*implicit_account_creation.ed25519_address())),
Address::ImplicitAccountCreation(implicit_account_creation) => {
self.required_inputs.contains(input.output_id())
&& self
.addresses
.contains(&Address::from(*implicit_account_creation.ed25519_address()))
}
_ => self.addresses.contains(&required_address),
}
})
Expand Down

0 comments on commit dc7dfc2

Please sign in to comment.