Skip to content

Commit

Permalink
ISA: fix implicit account transition (iotaledger#2029)
Browse files Browse the repository at this point in the history
  • Loading branch information
thibault-martinez authored Feb 20, 2024
1 parent 60ab6cf commit 28af551
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sdk/src/client/api/block_builder/input_selection/remainder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ impl InputSelection {

fn output_for_added_mana_exists(&self, remainder_address: &Address) -> bool {
// Find the first value that matches the remainder address
self.added_outputs.iter().any(|o| {
self.non_remainder_outputs().any(|o| {
(o.is_basic() || o.is_account() || o.is_anchor() || o.is_nft())
&& o.unlock_conditions()
.map_or(true, |uc| uc.expiration().is_none() && uc.timelock().is_none())
Expand All @@ -189,14 +189,16 @@ impl InputSelection {
]);
// Remove those that do not have an ordering and sort
let ordered_outputs = self
.added_outputs
.provided_outputs
.iter_mut()
.chain(&mut self.added_outputs)
.filter(|o| {
o.unlock_conditions()
.map_or(true, |uc| uc.expiration().is_none() && uc.timelock().is_none())
})
.filter_map(|o| sort_order.get(&o.kind()).map(|order| (*order, o)))
.collect::<BTreeMap<_, _>>();

// Find the first value that matches the remainder address
ordered_outputs.into_values().find(|o| {
matches!(o.required_address(
Expand Down

0 comments on commit 28af551

Please sign in to comment.