Skip to content

Commit

Permalink
gui: do not let user try recovery if one block left
Browse files Browse the repository at this point in the history
  • Loading branch information
pythcoiner committed Jul 23, 2024
1 parent ee9cfb9 commit 755e727
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gui/src/app/state/recovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ fn recovery_paths(wallet: &Wallet, coins: &[Coin], blockheight: i32) -> Vec<Reco
.iter()
.filter(|coin| {
coin.spend_info.is_none()
&& remaining_sequence(coin, blockheight as u32, sequence) <= 1
&& remaining_sequence(coin, blockheight as u32, sequence) < 1
})
.fold(
(0, Amount::from_sat(0)),
Expand Down
14 changes: 9 additions & 5 deletions gui/src/app/view/recovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,14 @@ pub fn recovery<'a>(
Container::new(
Column::new()
.spacing(20)
.push(text(format!(
"{} recovery paths will be available at the next block, select one:",
recovery_paths.len()
)))
.push(text(if recovery_paths.len() == 1 {
"1 recovery path is available, please select:".to_string()
} else {
format!(
"{} recovery paths are available, select one:",
recovery_paths.len()
)
}))
.push(Column::with_children(recovery_paths).spacing(20)),
)
.style(theme::Container::Card(theme::Card::Simple))
Expand Down Expand Up @@ -190,7 +194,7 @@ pub fn recovery_path_view<'a>(
.push(text(format!(
"{} coin{} totalling",
number_of_coins,
if number_of_coins > 0 { "s" } else { "" }
if number_of_coins > 1 { "s" } else { "" }
)))
.push(amount(&total_amount)),
)
Expand Down

0 comments on commit 755e727

Please sign in to comment.