Skip to content

Commit

Permalink
remove automatically_transitioned
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Coats committed Feb 15, 2024
1 parent 4ba7497 commit d8c9ac4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 23 deletions.
2 changes: 0 additions & 2 deletions sdk/src/client/api/block_builder/input_selection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ pub struct InputSelection {
creation_slot: SlotIndex,
latest_slot_commitment_id: SlotCommitmentId,
requirements: Vec<Requirement>,
automatically_transitioned: HashSet<ChainId>,
min_mana_allotment: Option<MinManaAllotment>,
mana_allotments: BTreeMap<AccountId, u64>,
mana_rewards: HashMap<OutputId, u64>,
Expand Down Expand Up @@ -128,7 +127,6 @@ impl InputSelection {
creation_slot: creation_slot_index.into(),
latest_slot_commitment_id,
requirements: Vec::new(),
automatically_transitioned: HashSet::new(),
min_mana_allotment: None,
mana_allotments: Default::default(),
mana_rewards: Default::default(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,19 +247,7 @@ impl InputSelection {

fn reduce_funds_of_chains(&mut self, amount_selection: &mut AmountSelection) -> Result<(), Error> {
// Only consider automatically transitioned outputs.
let outputs = self
.provided_outputs
.iter_mut()
.chain(&mut self.added_outputs)
.filter(|output| {
output
.chain_id()
.as_ref()
.map(|chain_id| self.automatically_transitioned.contains(chain_id))
.unwrap_or(false)
});

for output in outputs {
for output in self.added_outputs.iter_mut() {
let diff = amount_selection.missing_amount();
let amount = output.amount();
let minimum_amount = output.minimum_amount(self.protocol_parameters.storage_score_parameters());
Expand Down
10 changes: 2 additions & 8 deletions sdk/src/client/api/block_builder/input_selection/transition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use super::{
use crate::{
client::secret::types::InputSigningData,
types::block::output::{
AccountOutput, AccountOutputBuilder, ChainId, FoundryOutput, FoundryOutputBuilder, NftOutput, NftOutputBuilder,
Output, OutputId,
AccountOutput, AccountOutputBuilder, FoundryOutput, FoundryOutputBuilder, NftOutput, NftOutputBuilder, Output,
OutputId,
},
};

Expand Down Expand Up @@ -69,8 +69,6 @@ impl InputSelection {

let output = builder.finish_output()?;

self.automatically_transitioned.insert(ChainId::from(account_id));

log::debug!("Automatic transition of {output_id:?}/{account_id:?}");

Ok(Some(output))
Expand Down Expand Up @@ -108,8 +106,6 @@ impl InputSelection {
.with_features(features)
.finish_output()?;

self.automatically_transitioned.insert(ChainId::from(nft_id));

log::debug!("Automatic transition of {output_id:?}/{nft_id:?}");

Ok(Some(output))
Expand Down Expand Up @@ -145,8 +141,6 @@ impl InputSelection {

let output = FoundryOutputBuilder::from(input).finish_output()?;

self.automatically_transitioned.insert(ChainId::from(foundry_id));

log::debug!("Automatic transition of {output_id:?}/{foundry_id:?}");

Ok(Some(output))
Expand Down

0 comments on commit d8c9ac4

Please sign in to comment.