From 1a9f820ab66836a6e7c662a260a3dbfd267f7667 Mon Sep 17 00:00:00 2001 From: Thibault Martinez Date: Mon, 15 Jan 2024 13:56:42 +0100 Subject: [PATCH] Nits --- .../api/block_builder/input_selection/remainder.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sdk/src/client/api/block_builder/input_selection/remainder.rs b/sdk/src/client/api/block_builder/input_selection/remainder.rs index ae5450ba70..849d1359ef 100644 --- a/sdk/src/client/api/block_builder/input_selection/remainder.rs +++ b/sdk/src/client/api/block_builder/input_selection/remainder.rs @@ -15,8 +15,8 @@ use crate::{ types::block::{ address::{Address, Ed25519Address}, output::{ - unlock_condition::AddressUnlockCondition, AccountOutputBuilder, BasicOutputBuilder, FoundryOutputBuilder, - MinimumOutputAmount, NativeTokensBuilder, NftOutputBuilder, Output, + unlock_condition::AddressUnlockCondition, AccountOutputBuilder, BasicOutputBuilder, MinimumOutputAmount, + NativeTokensBuilder, NftOutputBuilder, Output, }, }, }; @@ -87,7 +87,7 @@ impl InputSelection { pub(crate) fn remainder_and_storage_deposit_return_outputs( &mut self, ) -> Result<(Option, Vec), Error> { - let (inputs_sum, outputs_sum, inputs_sdr, outputs_sdr) = + let (input_amount, output_amount, inputs_sdr, outputs_sdr) = amount_sums(&self.selected_inputs, &self.outputs, self.slot_index); let mut storage_deposit_returns = Vec::new(); @@ -149,16 +149,16 @@ impl InputSelection { let output_mana = self.outputs.iter().map(|o| o.mana()).sum::() + self.mana_allotments; - if inputs_sum == outputs_sum && input_mana == output_mana && native_tokens_diff.is_none() { + if input_amount == output_amount && input_mana == output_mana && native_tokens_diff.is_none() { log::debug!("No remainder required"); return Ok((None, storage_deposit_returns)); } // TODO underflows? - let amount_diff = inputs_sum - outputs_sum; + let amount_diff = input_amount - output_amount; let mana_diff = input_mana - output_mana; - if inputs_sum == outputs_sum && input_mana != output_mana && native_tokens_diff.is_none() { + if input_amount == output_amount && input_mana != output_mana && native_tokens_diff.is_none() { let output = self .outputs .iter_mut()