Skip to content

Conversation

ChiefWoods
Copy link

#1

Let me know if there's any feedback

// Load authority keypair
let spinner = CliProgress::new_spinner("Loading authority keypair...");
let authority_keypair = load_keypair_from_file(&config.program.authority_keypair)?;
let authority_keypair = if let Some(ak) = authority_keypair_arg {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps a match statement would be cleaner?

  let authority_keypair = match authority_keypair_arg {
      Some(ak) => load_keypair_from_file(ak.trim())?,
      None => load_keypair_from_file(&config.program.authority_keypair)?,
  };

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, I based my changes off auth.rs

@0xsouravm
Copy link
Owner

Everything else lgtm!

let spinner = CliProgress::new_spinner("Loading authority keypair...");
let authority_keypair = load_keypair_from_file(&config.program.authority_keypair)?;
let authority_keypair = match authority_keypair_arg {
Some(ak) => load_keypair_from_file(ak.trim())?,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are checking for an empty path in the config keypair path, I think we should also check for the argument keypair path.

  1. Get authority keypair path from either argument or config
  2. Check if it is empty
  3. Throw error if empty, else proceed to load and assign to authority_keypair

What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants