Skip to content
This repository has been archived by the owner on Jun 3, 2020. It is now read-only.

Commit

Permalink
remove boilerplate / unused code
Browse files Browse the repository at this point in the history
 - ledger sub-commands do not do anything
 - fix ledgertm::init (config -> ledgertm_configs)
 - fmt
  • Loading branch information
liamsi committed Feb 20, 2019
1 parent 88c2ba9 commit 2dd4809
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 16 deletions.
11 changes: 0 additions & 11 deletions src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ mod yubihsm;
#[cfg(feature = "yubihsm")]
pub use self::yubihsm::YubihsmCommand;

#[cfg(feature = "ledgertm")]
mod ledgertm;
#[cfg(feature = "ledgertm")]
pub use self::ledgertm::LedgertmCommand;

pub use self::{
help::HelpCommand, keygen::KeygenCommand, start::StartCommand, version::VersionCommand,
};
Expand All @@ -42,10 +37,6 @@ pub enum KmsCommand {
#[cfg(feature = "yubihsm")]
#[options(help = "subcommands for YubiHSM2")]
Yubihsm(YubihsmCommand),

#[cfg(feature = "ledgertm")]
#[options(help = "subcommands for Ledger Tendermint app")]
Ledgertm(LedgertmCommand),
}

// TODO: refactor abscissa internally so this is all part of the proc macro
Expand Down Expand Up @@ -89,8 +80,6 @@ impl Callable for KmsCommand {
KmsCommand::Version(version) => version.call(),
#[cfg(feature = "yubihsm")]
KmsCommand::Yubihsm(yubihsm) => yubihsm.call(),
#[cfg(feature = "ledgertm")]
KmsCommand::Ledgertm(ledgertm) => ledgertm.call(),
}
}
}
9 changes: 6 additions & 3 deletions src/keyring/ed25519/ledgertm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@ use signatory_ledger_tm::{self, Ed25519LedgerTmAppSigner};

use crate::{
config::provider::ledgertm::LedgerTendermintConfig,
error::KmsError,
error::{KmsError, KmsErrorKind::*},
keyring::{ed25519::Signer, KeyRing},
};

pub const LEDGER_TM_PROVIDER_LABEL: &str = "ledgertm";
pub const LEDGER_TM_ID: &str = "ledgertm";

/// Create Ledger Tendermint signer object from the given configuration
pub fn init(keyring: &mut KeyRing, ledgertm_configs: &[LedgerTendermintConfig]) -> Result<(), KmsError> {
pub fn init(
keyring: &mut KeyRing,
ledgertm_configs: &[LedgerTendermintConfig],
) -> Result<(), KmsError> {
if ledgertm_configs.is_empty() {
return Ok(());
}
Expand All @@ -22,7 +25,7 @@ pub fn init(keyring: &mut KeyRing, ledgertm_configs: &[LedgerTendermintConfig])
fail!(
ConfigError,
"expected one [providers.ledgertm] in config, found: {}",
config.len()
ledgertm_configs.len()
);
}
let provider = Box::new(Ed25519LedgerTmAppSigner::connect()?);
Expand Down
2 changes: 0 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ mod client;
mod commands;
mod config;
mod keyring;
#[cfg(feature = "ledgertm")]
mod ledgertm;
mod rpc;
mod session;
mod unix_connection;
Expand Down

0 comments on commit 2dd4809

Please sign in to comment.