[T4] warning cleanup (#1713)

* clean up warnings
* rustfmt
This commit is contained in:
Yeastplume 2018-10-10 16:56:15 +01:00 committed by Ignotus Peverell
parent e69b2ace70
commit d756da062a
7 changed files with 11 additions and 24 deletions

View file

@ -31,9 +31,6 @@ use util::LOGGER;
const MAX_MINEABLE_WEIGHT: usize = const MAX_MINEABLE_WEIGHT: usize =
consensus::MAX_BLOCK_WEIGHT - consensus::BLOCK_OUTPUT_WEIGHT - consensus::BLOCK_KERNEL_WEIGHT; consensus::MAX_BLOCK_WEIGHT - consensus::BLOCK_OUTPUT_WEIGHT - consensus::BLOCK_KERNEL_WEIGHT;
// longest chain of dependent transactions that can be included in a block
const MAX_TX_CHAIN: usize = 20;
pub struct Pool { pub struct Pool {
/// Entries in the pool (tx + info + timer) in simple insertion order. /// Entries in the pool (tx + info + timer) in simple insertion order.
pub entries: Vec<PoolEntry>, pub entries: Vec<PoolEntry>,

View file

@ -30,7 +30,7 @@ use common::stats::{StratumStats, WorkerStats};
use common::types::{StratumServerConfig, SyncState}; use common::types::{StratumServerConfig, SyncState};
use core::core::verifier_cache::VerifierCache; use core::core::verifier_cache::VerifierCache;
use core::core::Block; use core::core::Block;
use core::{global, pow, ser}; use core::{pow, ser};
use keychain; use keychain;
use mining::mine_block; use mining::mine_block;
use pool; use pool;

View file

@ -205,7 +205,7 @@ pub fn wallet_command(wallet_args: &ArgMatches, config: GlobalWalletConfig) {
let acct_mappings = api.accounts()?; let acct_mappings = api.accounts()?;
// give logging thread a moment to catch up // give logging thread a moment to catch up
thread::sleep(Duration::from_millis(200)); thread::sleep(Duration::from_millis(200));
display::accounts(acct_mappings, false); display::accounts(acct_mappings);
Ok(()) Ok(())
}); });
if res.is_err() { if res.is_err() {

View file

@ -214,7 +214,7 @@ pub fn info(account: &str, wallet_info: &WalletInfo, validated: bool) {
} }
} }
/// Display list of wallet accounts in a pretty way /// Display list of wallet accounts in a pretty way
pub fn accounts(acct_mappings: Vec<AcctPathMapping>, show_derivations: bool) { pub fn accounts(acct_mappings: Vec<AcctPathMapping>) {
println!("\n____ Wallet Accounts ____\n",); println!("\n____ Wallet Accounts ____\n",);
let mut table = table!(); let mut table = table!();

View file

@ -116,7 +116,6 @@ where
// write the output representing our change // write the output representing our change
for (change_amount, id) in &change_amounts_derivations { for (change_amount, id) in &change_amounts_derivations {
let change_id = keychain.derive_key(&id).unwrap();
t.num_outputs += 1; t.num_outputs += 1;
t.amount_credited += change_amount; t.amount_credited += change_amount;
batch.save(OutputData { batch.save(OutputData {
@ -311,7 +310,7 @@ where
// build transaction skeleton with inputs and change // build transaction skeleton with inputs and change
let (mut parts, change_amounts_derivations) = let (mut parts, change_amounts_derivations) =
inputs_and_change(&coins, wallet, amount, fee, change_outputs, parent_key_id)?; inputs_and_change(&coins, wallet, amount, fee, change_outputs)?;
// This is more proof of concept than anything but here we set lock_height // This is more proof of concept than anything but here we set lock_height
// on tx being sent (based on current chain height via api). // on tx being sent (based on current chain height via api).
@ -327,7 +326,6 @@ pub fn inputs_and_change<T: ?Sized, C, K>(
amount: u64, amount: u64,
fee: u64, fee: u64,
num_change_outputs: usize, num_change_outputs: usize,
parent_key_id: &Identifier,
) -> Result<(Vec<Box<build::Append<K>>>, Vec<(u64, Identifier)>), Error> ) -> Result<(Vec<Box<build::Append<K>>>, Vec<(u64, Identifier)>), Error>
where where
T: WalletBackend<C, K>, T: WalletBackend<C, K>,
@ -379,7 +377,6 @@ where
part_change part_change
}; };
let keychain = wallet.keychain().clone();
let change_key = wallet.next_child().unwrap(); let change_key = wallet.next_child().unwrap();
change_amounts_derivations.push((change_amount, change_key.clone())); change_amounts_derivations.push((change_amount, change_key.clone()));
@ -418,8 +415,7 @@ where
.filter(|out| { .filter(|out| {
out.root_key_id == *parent_key_id out.root_key_id == *parent_key_id
&& out.eligible_to_spend(current_height, minimum_confirmations) && out.eligible_to_spend(current_height, minimum_confirmations)
}) }).collect::<Vec<OutputData>>();
.collect::<Vec<OutputData>>();
let max_available = eligible.len(); let max_available = eligible.len();
@ -482,8 +478,7 @@ fn select_from(amount: u64, select_all: bool, outputs: Vec<OutputData>) -> Optio
let res = selected_amount < amount; let res = selected_amount < amount;
selected_amount += out.value; selected_amount += out.value;
res res
}) }).cloned()
.cloned()
.collect(), .collect(),
); );
} }

View file

@ -228,14 +228,8 @@ where
let fee = tx_fee(coins.len(), 2, 1, None); let fee = tx_fee(coins.len(), 2, 1, None);
let num_change_outputs = 1; let num_change_outputs = 1;
let (mut parts, _) = selection::inputs_and_change( let (mut parts, _) =
&coins, selection::inputs_and_change(&coins, wallet, amount, fee, num_change_outputs)?;
wallet,
amount,
fee,
num_change_outputs,
parent_key_id,
)?;
//TODO: If we end up using this, create change output here //TODO: If we end up using this, create change output here

View file

@ -28,7 +28,7 @@ use uuid::Uuid;
use core::core::hash::Hash; use core::core::hash::Hash;
use core::ser; use core::ser;
use keychain::{ExtKeychain, Identifier, Keychain}; use keychain::{Identifier, Keychain};
use libtx::aggsig; use libtx::aggsig;
use libtx::slate::Slate; use libtx::slate::Slate;
@ -448,7 +448,8 @@ impl BlockIdentifier {
/// convert to hex string /// convert to hex string
pub fn from_hex(hex: &str) -> Result<BlockIdentifier, Error> { pub fn from_hex(hex: &str) -> Result<BlockIdentifier, Error> {
let hash = Hash::from_hex(hex).context(ErrorKind::GenericError("Invalid hex".to_owned()))?; let hash =
Hash::from_hex(hex).context(ErrorKind::GenericError("Invalid hex".to_owned()))?;
Ok(BlockIdentifier(hash)) Ok(BlockIdentifier(hash))
} }
} }