Make Transaction Field in V4 Slate Optional (#356)

* make transaction field in V4 Slate optional

* add mutable/non mutable version of tx getter

* removal of mut references where not needed

* remove more muts

* update from master

* update from master

* test fixes
This commit is contained in:
Yeastplume
2020-03-10 18:19:27 +00:00
committed by GitHub
parent aebc352fbe
commit c42d5ddcff
35 changed files with 312 additions and 205 deletions
+5 -5
View File
@@ -49,8 +49,8 @@ impl WalletSeed {
}
pub fn _from_hex(hex: &str) -> Result<WalletSeed, Error> {
let bytes = util::from_hex(hex.to_string())
.context(ErrorKind::GenericError("Invalid hex".to_owned()))?;
let bytes = util::from_hex(&hex.to_string())
.map_err(|_| ErrorKind::GenericError("Invalid hex".to_owned()))?;
Ok(WalletSeed::from_bytes(&bytes))
}
@@ -274,15 +274,15 @@ impl EncryptedWalletSeed {
/// Decrypt seed
pub fn decrypt(&self, password: &str) -> Result<WalletSeed, Error> {
let mut encrypted_seed = match util::from_hex(self.encrypted_seed.clone()) {
let mut encrypted_seed = match util::from_hex(&self.encrypted_seed.clone()) {
Ok(s) => s,
Err(_) => return Err(ErrorKind::Encryption.into()),
};
let salt = match util::from_hex(self.salt.clone()) {
let salt = match util::from_hex(&self.salt.clone()) {
Ok(s) => s,
Err(_) => return Err(ErrorKind::Encryption.into()),
};
let nonce = match util::from_hex(self.nonce.clone()) {
let nonce = match util::from_hex(&self.nonce.clone()) {
Ok(s) => s,
Err(_) => return Err(ErrorKind::Encryption.into()),
};