From f3ba74372c9e948c80c0b628a4f6ce7fa863a950 Mon Sep 17 00:00:00 2001 From: Aditya Kulkarni Date: Tue, 1 Oct 2019 17:37:25 -0700 Subject: [PATCH] Fix TODOs --- src/commands.rs | 3 --- src/lightclient.rs | 8 ++++---- src/lightwallet/mod.rs | 4 +--- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/commands.rs b/src/commands.rs index 87738ac..3188137 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -373,9 +373,6 @@ impl Command for QuitCommand { } } -// TODO: Add rescan command -// TODO: Add consolidate command to consolidate t inputs - pub fn get_commands() -> Box>> { let mut map: HashMap> = HashMap::new(); diff --git a/src/lightclient.rs b/src/lightclient.rs index 70c3c26..8a1d7ab 100644 --- a/src/lightclient.rs +++ b/src/lightclient.rs @@ -511,7 +511,7 @@ impl LightClient { "created_in_txid" => format!("{}", utxo.txid), "value" => utxo.value, "scriptkey" => hex::encode(utxo.script.clone()), - "is_change" => false, // TODO: Identify notes as change + "is_change" => false, // TODO: Identify notes as change if we send change to taddrs "address" => utxo.address.clone(), "spent" => utxo.spent.map(|spent_txid| format!("{}", spent_txid)), "unconfirmed_spent" => utxo.unconfirmed_spent.map(|spent_txid| format!("{}", spent_txid)), @@ -528,7 +528,7 @@ impl LightClient { "created_in_txid" => format!("{}", utxo.txid), "value" => utxo.value, "scriptkey" => hex::encode(utxo.script.clone()), - "is_change" => false, // TODO: Identify notes as change + "is_change" => false, // TODO: Identify notes as change if we send change to taddrs "address" => utxo.address.clone(), "spent" => utxo.spent.map(|spent_txid| format!("{}", spent_txid)), "unconfirmed_spent" => utxo.unconfirmed_spent.map(|spent_txid| format!("{}", spent_txid)), @@ -559,7 +559,7 @@ impl LightClient { "created_in_txid" => format!("{}", utxo.txid), "value" => utxo.value, "scriptkey" => hex::encode(utxo.script.clone()), - "is_change" => false, // TODO: Identify notes as change + "is_change" => false, // TODO: Identify notes as change if we send change to taddrs "address" => utxo.address.clone(), "spent" => utxo.spent.map(|spent_txid| format!("{}", spent_txid)), "unconfirmed_spent" => utxo.unconfirmed_spent.map(|spent_txid| format!("{}", spent_txid)), @@ -769,7 +769,7 @@ impl LightClient { let tx = Transaction::read(tx_bytes).unwrap(); // Scan this Tx for transparent inputs and outputs - wallet.scan_full_tx(&tx, height as i32); // TODO: Add the height here! + wallet.scan_full_tx(&tx, height as i32); } ); diff --git a/src/lightwallet/mod.rs b/src/lightwallet/mod.rs index d799f6e..f589355 100644 --- a/src/lightwallet/mod.rs +++ b/src/lightwallet/mod.rs @@ -172,7 +172,7 @@ impl LightWallet { let ext_t_key = ExtendedPrivKey::with_seed(&bip39_seed.as_bytes()).unwrap(); let tpk = ext_t_key .derive_private_key(KeyIndex::hardened_from_normalize_index(44).unwrap()).unwrap() - .derive_private_key(KeyIndex::hardened_from_normalize_index(1).unwrap()).unwrap() // TODO: Cointype + .derive_private_key(KeyIndex::hardened_from_normalize_index(config.get_coin_type()).unwrap()).unwrap() .derive_private_key(KeyIndex::hardened_from_normalize_index(0).unwrap()).unwrap() .derive_private_key(KeyIndex::Normal(0)).unwrap() .derive_private_key(KeyIndex::Normal(0)).unwrap() @@ -648,8 +648,6 @@ impl LightWallet { } } - // TODO: Scan t outputs if we spent t or z funds in this Tx, and add it to the - // outgoing metadata { let total_shielded_value_spent = self.txs.read().unwrap().get(&tx.txid()).map_or(0, |wtx| wtx.total_shielded_value_spent); if total_transparent_spend + total_shielded_value_spent > 0 {