From 5c66dafade3259e7073f07fc42876fda630675a3 Mon Sep 17 00:00:00 2001 From: Neotamandua <107320179+Neotamandua@users.noreply.github.com> Date: Thu, 5 Oct 2023 14:47:15 +0200 Subject: [PATCH] add clearer text --- src/bin/interactive.rs | 2 +- src/bin/io/prompt.rs | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/bin/interactive.rs b/src/bin/interactive.rs index 2ae5cf10..bd7bfd82 100644 --- a/src/bin/interactive.rs +++ b/src/bin/interactive.rs @@ -213,7 +213,7 @@ fn menu_op( .add(CMI::History, "Transaction History") .add(CMI::Transfer, "Transfer Dusk") .add(CMI::Stake, "Stake Dusk") - .add(CMI::StakeAllow, "Stake Allow") + .add(CMI::StakeAllow, "Allow staking key") .add(CMI::StakeInfo, "Check existing stake") .add(CMI::Unstake, "Unstake Dusk") .add(CMI::Withdraw, "Withdraw staking reward") diff --git a/src/bin/io/prompt.rs b/src/bin/io/prompt.rs index 3a74f1ac..0135ae26 100644 --- a/src/bin/io/prompt.rs +++ b/src/bin/io/prompt.rs @@ -232,11 +232,18 @@ fn check_valid_denom(value: f64, balance: Dusk) -> Result<(), String> { } fn check_valid_pkey(key: &str) -> Result<(), String> { - let key_length = bs58::decode(key).into_vec().unwrap_or(vec![]).len(); + let key_length = match bs58::decode(key).into_vec() { + Ok(v) => v.len(), + Err(_) => { + return Err( + "Please introduce a valid provisioner key (Base58)".to_string() + ) + } + }; if key_length == PROVISIONER_KEY_LENGTH { Ok(()) } else { - Err("Please introduce a valid provisioner key".to_string()) + Err(format!("Invalid provisioner key length. Key should be {} bytes long but was {} bytes long", PROVISIONER_KEY_LENGTH, key_length)) } }