Skip to content

Commit

Permalink
garden (#19)
Browse files Browse the repository at this point in the history
Co-authored-by: Olitelkes <93093792+Olitelkes@users.noreply.github.com>
  • Loading branch information
xhjkl and Olitelkes committed Aug 3, 2023
1 parent 1d78b80 commit 92676c9
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 20 deletions.
4 changes: 2 additions & 2 deletions cli/common/src/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,11 +463,11 @@ impl<'a> Snapshot<'a> {

// RpcError::ForUser is also what `confirm_transaction_with_spinner`
// returns if it fails to confirm within a certain time.
return Err(RpcError::ForUser(format!(
Err(RpcError::ForUser(format!(
"Failed to confirm transaction {} within 32 seconds.",
signature,
))
.into());
.into())
}

/// Send a transaction, show a spinner on stdout.
Expand Down
36 changes: 19 additions & 17 deletions cli/maintainer/src/commands_multisig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1416,9 +1416,9 @@ impl fmt::Display for ApproveOutput {
}
}

fn approve<'a>(
fn approve(
config: &mut SnapshotClientConfig,
transactions: &'a [Pubkey],
transactions: &[Pubkey],
multisig_program_id: &Pubkey,
multisig_address: &Pubkey,
) -> std::result::Result<ApproveOutput, crate::Error> {
Expand Down Expand Up @@ -1524,28 +1524,30 @@ fn approve_batch(
Ok(())
}

/// Prompt the user to enter 'Y' or 'N'.
/// Prompt the user to enter Yes or No.
fn ask_user_y_n(prompt: &'static str) -> bool {
use std::io::{BufRead, Write};
let mut buf = String::new();

let stdin = std::io::stdin();
let mut stdout = std::io::stdout();
let mut input = String::new();

loop {
print!("{} [Y/N] ", prompt);
std::io::stdout()
.lock()
.flush()
.expect("Failed to flush to stdout.");
std::io::stdin()
stdout.flush().expect("Failed to flush to stdout.");

input.clear();
let _ = stdin
.lock()
.read_line(&mut buf)
.read_line(&mut input)
.expect("Failed to read from stdin.");

match &buf[..] {
"Y\n" => return true,
"N\n" => return false,
_ => {
println!("Please enter the character 'Y' or 'N' (case-sensitive).");
buf.clear();
}
let input = input.trim().to_lowercase();

match input {
_ if input.starts_with('y') => return true,
_ if input.starts_with('n') => return false,
_ => println!("Please enter `y` or `n`."),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/test_solido.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
This script calls 'solana' and 'solido' to confirm that functionality works.
It exits with exit code 0 if everything works as expected, or with a nonzero
exit code if anything fails. It expects a test validator to be running at at the
exit code if anything fails. It expects a test validator to be running at the
default localhost port, and it expects a keypair at ~/.config/solana/id.json
that corresponds to a sufficiently funded account.
Expand Down

0 comments on commit 92676c9

Please sign in to comment.