diff --git a/gui/src/app/state/spend/step.rs b/gui/src/app/state/spend/step.rs index 6efe4647..0cd1f2bd 100644 --- a/gui/src/app/state/spend/step.rs +++ b/gui/src/app/state/spend/step.rs @@ -68,7 +68,6 @@ pub trait Step { } pub struct DefineSpend { - balance_available: Amount, recipients: Vec, /// If set, this is the index of a recipient that should /// receive the max amount. @@ -99,16 +98,6 @@ impl DefineSpend { coins: &[Coin], timelock: u16, ) -> Self { - let balance_available = coins - .iter() - .filter_map(|coin| { - if coin.spend_info.is_none() { - Some(coin.amount) - } else { - None - } - }) - .sum(); let coins: Vec<(Coin, bool)> = coins .iter() .filter_map(|c| { @@ -121,7 +110,6 @@ impl DefineSpend { .collect(); Self { - balance_available, network, descriptor, curve: secp256k1::Secp256k1::verification_only(), @@ -630,7 +618,6 @@ impl Step for DefineSpend { fn view<'a>(&'a self, cache: &'a Cache) -> Element<'a, view::Message> { view::spend::create_spend_tx( cache, - &self.balance_available, self.recipients .iter() .enumerate() @@ -640,12 +627,6 @@ impl Step for DefineSpend { .map(view::Message::CreateSpend) }) .collect(), - Amount::from_sat( - self.recipients - .iter() - .map(|r| r.amount().unwrap_or(0_u64)) - .sum(), - ), self.is_valid, self.is_duplicate, self.timelock, diff --git a/gui/src/app/view/spend/mod.rs b/gui/src/app/view/spend/mod.rs index a5c9099f..4f5ad1e1 100644 --- a/gui/src/app/view/spend/mod.rs +++ b/gui/src/app/view/spend/mod.rs @@ -112,9 +112,7 @@ pub fn spend_view<'a>( #[allow(clippy::too_many_arguments)] pub fn create_spend_tx<'a>( cache: &'a Cache, - balance_available: &'a Amount, recipients: Vec>, - total_amount: Amount, is_valid: bool, duplicate: bool, timelock: u16, @@ -300,9 +298,7 @@ pub fn create_spend_tx<'a>( .push( if is_valid && !duplicate - && (is_self_send - || (total_amount < *balance_available - && Some(&Amount::from_sat(0)) == amount_left)) + && (is_self_send || Some(&Amount::from_sat(0)) == amount_left) { button::primary(None, "Next") .on_press(Message::CreateSpend(CreateSpendMessage::Generate))