Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added validate_domain Electrum option #151

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

anmode
Copy link

@anmode anmode commented Apr 3, 2023

Description

fixes #134

Notes to the reviewers

Changelog notice

Checklists

All Submissions:

  • I've signed all my commits
  • I followed the contribution guidelines
  • I ran cargo fmt and cargo clippy before committing

New Features:

  • I've added tests for the new feature
  • I've added docs for the new feature
  • I've updated CHANGELOG.md

Bugfixes:

  • This pull request breaks the existing API
  • I've added tests to reproduce the issue which are now passing
  • I'm linking the issue being fixed by this PR
    cc @rajarshimaitra @danielabrozzoni

Signed-off-by: Anmol Agrawal <[email protected]>
@anmode
Copy link
Author

anmode commented Apr 4, 2023

Sorry! Now after testing I pushed. I Hope all check to pass.

@notmandatory
Copy link
Member

Hi, thanks for adding a validate_domain option, can you make it a flag instead of something that takes a true or false value? See here: https://docs.rs/clap/latest/clap/_derive/_tutorial/index.html#flags

@anmode
Copy link
Author

anmode commented Apr 9, 2023

Ohh okay!! I tried!.

Copy link
Member

@notmandatory notmandatory left a comment

Choose a reason for hiding this comment

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

You should always run the tests locally to verify your code changes are correct.

@@ -320,6 +320,10 @@ pub struct ElectrumOpts {
default_value = "10"
)]
pub stop_gap: usize,

/// Enable or disable domain validation when connecting to Electrum servers.
#[clap(name = "VALIDATE_DOMAIN", long = "validate_domain", takes_value(false))]
Copy link
Member

Choose a reason for hiding this comment

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

you shouldn't need takes_value(false)

Suggested change
#[clap(name = "VALIDATE_DOMAIN", long = "validate_domain", takes_value(false))]
#[clap(name = "VALIDATE_DOMAIN", long = "validate_domain")]

Copy link
Author

Choose a reason for hiding this comment

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

sure!


/// Enable or disable domain validation when connecting to Electrum servers.
#[clap(name = "VALIDATE_DOMAIN", long = "validate_domain", takes_value(false))]
pub validate_domain: Option<bool>,
Copy link
Member

Choose a reason for hiding this comment

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

This shouldn't be an Option, only a bool, if the flag isn't used then the value will default to false.

Suggested change
pub validate_domain: Option<bool>,
pub validate_domain: bool,

Copy link
Author

Choose a reason for hiding this comment

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

oh, Okayy

@anmode
Copy link
Author

anmode commented Apr 15, 2023

Sorry, Actually, i am new so didn't know about what testing commands are. As I did cargo fmt , cargo clippy, and cargo test. All goes well. I see in github action workflow cargo test --no-default-features --features repl,electrum. Ok I'll make changes and push soon!

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

Successfully merging this pull request may close these issues.

Add validate_domain Electrum option
2 participants