Skip to content

Commit

Permalink
Merge remote-tracking branch 'labs/dev' into value_transfers
Browse files Browse the repository at this point in the history
  • Loading branch information
fluidvanadium committed Nov 19, 2024
2 parents 0912cef + 40c20b7 commit c98b5ca
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 10 deletions.
41 changes: 41 additions & 0 deletions zingolib/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1679,6 +1679,46 @@ impl Command for NewAddressCommand {
}
}

struct NotesCommand {}
impl Command for NotesCommand {
fn help(&self) -> &'static str {
indoc! {r#"
Show all shielded notes and transparent coins in this wallet
Usage:
notes [all]
If you supply the "all" parameter, all previously spent shielded notes and transparent coins are also included
"#}
}

fn short_help(&self) -> &'static str {
"Show all shielded notes and transparent coins in this wallet"
}

fn exec(&self, args: &[&str], lightclient: &LightClient) -> String {
// Parse the args.
if args.len() > 1 {
return self.short_help().to_string();
}

// Make sure we can parse the amount
let all_notes = if args.len() == 1 {
match args[0] {
"all" => true,
a => {
return format!(
"Invalid argument \"{}\". Specify 'all' to include unspent notes",
a
)
}
}
} else {
false
};

RT.block_on(async move { lightclient.do_list_notes(all_notes).await.pretty(2) })
}
}

struct QuitCommand {}
impl Command for QuitCommand {
fn help(&self) -> &'static str {
Expand Down Expand Up @@ -1798,6 +1838,7 @@ pub fn get_commands() -> HashMap<&'static str, Box<dyn Command>> {
("shield", Box::new(ShieldCommand {})),
("save", Box::new(DeprecatedNoCommand {})),
("quit", Box::new(QuitCommand {})),
("notes", Box::new(NotesCommand {})),
("new", Box::new(NewAddressCommand {})),
("defaultfee", Box::new(DefaultFeeCommand {})),
("seed", Box::new(SeedCommand {})),
Expand Down
10 changes: 0 additions & 10 deletions zingolib/src/wallet/transaction_records_by_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -781,16 +781,6 @@ impl TransactionRecordsById {
if let Ok(notes_from_tx) =
transaction_record.get_spendable_note_ids_and_values(sources, exclude)
{
if transaction_record
.outgoing_tx_data
.iter()
.any(|outgoing_tx_data| outgoing_tx_data.output_index.is_none())
{
missing_output_index.push((
transaction_record.txid,
transaction_record.status.get_height(),
));
}
notes_from_tx
} else {
missing_output_index.push((
Expand Down

0 comments on commit c98b5ca

Please sign in to comment.