Skip to content

Commit

Permalink
Merge pull request #1463 from zancas/1.82
Browse files Browse the repository at this point in the history
1.81 --> 1.82
  • Loading branch information
juanky201271 authored Oct 19, 2024
2 parents d73f401 + 8f90636 commit 095f5c1
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 39 deletions.
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[toolchain]
channel = "1.81"
channel = "1.82"
components = [ "clippy", "rustfmt" ]
34 changes: 18 additions & 16 deletions zingocli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,28 +84,30 @@ fn parse_uri(s: &str) -> Result<http::Uri, String> {
/// currently this is just a whitespace delimited string of 24 words. I am
/// poking around to use the actual BIP39 parser (presumably from librustzcash).
fn parse_seed(s: &str) -> Result<String, String> {
if let Ok(s) = s.parse::<String>() {
let count = s.split_whitespace().count();
if count == 24 {
Ok(s)
} else {
Err(format!("Expected 24 words, but received: {}.", count))
match s.parse::<String>() {
Ok(s) => {
let count = s.split_whitespace().count();
if count == 24 {
Ok(s)
} else {
Err(format!("Expected 24 words, but received: {}.", count))
}
}
} else {
Err("Unexpected failure to parse String!!".to_string())
Err(_) => Err("Unexpected failure to parse String!!".to_string()),
}
}
/// Parse encoded UFVK to String and check for whitespaces
fn parse_ufvk(s: &str) -> Result<String, String> {
if let Ok(s) = s.parse::<String>() {
let count = s.split_whitespace().count();
if count == 1 {
Ok(s)
} else {
Err("Encoded UFVK should not contain whitespace!".to_string())
match s.parse::<String>() {
Ok(s) => {
let count = s.split_whitespace().count();
if count == 1 {
Ok(s)
} else {
Err("Encoded UFVK should not contain whitespace!".to_string())
}
}
} else {
Err("Unexpected failure to parse String!!".to_string())
Err(_) => Err("Unexpected failure to parse String!!".to_string()),
}
}
#[cfg(target_os = "linux")]
Expand Down
5 changes: 2 additions & 3 deletions zingolib/src/wallet/disk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,8 @@ impl LightWallet {
};
Vector::write(&mut writer, &seed_bytes, |w, byte| w.write_u8(*byte))?;

match &self.mnemonic {
Some(m) => writer.write_u32::<LittleEndian>(m.1)?,
None => (),
if let Some(m) = &self.mnemonic {
writer.write_u32::<LittleEndian>(m.1)?;
}

Ok(())
Expand Down
35 changes: 16 additions & 19 deletions zingolib/src/wallet/transaction_record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,27 +121,24 @@ impl TransactionRecord {
to: D::Recipient,
output_index: usize,
) {
match D::WalletNote::get_record_outputs(self)
if !D::WalletNote::get_record_outputs(self)
.iter_mut()
.find(|n| n.note() == &note)
.any(|n| n.note() == &note)
{
None => {
let nd = D::WalletNote::from_parts(
to.diversifier(),
note,
None,
None,
None,
None,
// if this is change, we'll mark it later in check_notes_mark_change
false,
false,
Some(output_index as u32),
);

D::WalletNote::transaction_metadata_notes_mut(self).push(nd);
}
Some(_) => {}
let nd = D::WalletNote::from_parts(
to.diversifier(),
note,
None,
None,
None,
None,
// if this is change, we'll mark it later in check_notes_mark_change
false,
false,
Some(output_index as u32),
);

D::WalletNote::transaction_metadata_notes_mut(self).push(nd);
}
}

Expand Down

0 comments on commit 095f5c1

Please sign in to comment.