pass in max_transactions to wallet send/burn from grin.rs (#272)

This commit is contained in:
AntiochP 2017-11-15 13:56:35 -05:00 committed by GitHub
parent 9f7e047aeb
commit f663340628
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 4 deletions

View file

@ -424,12 +424,14 @@ fn wallet_command(wallet_args: &ArgMatches) {
if let Some(d) = send_args.value_of("dest") {
dest = d;
}
let max_outputs = 500;
let result=wallet::issue_send_tx(
&wallet_config,
&keychain,
amount,
minimum_confirmations,
dest.to_string(),
max_outputs,
(selection_strategy == "all"),
);
match result {
@ -449,8 +451,14 @@ fn wallet_command(wallet_args: &ArgMatches) {
.unwrap()
.parse()
.expect("Could not parse minimum_confirmations as a whole number.");
wallet::issue_burn_tx(&wallet_config, &keychain, amount, minimum_confirmations)
.unwrap();
let max_outputs = 500;
wallet::issue_burn_tx(
&wallet_config,
&keychain,
amount,
minimum_confirmations,
max_outputs,
).unwrap();
}
("info", Some(_)) => {
wallet::show_info(&wallet_config, &keychain);

View file

@ -36,6 +36,7 @@ pub fn issue_send_tx(
amount: u64,
minimum_confirmations: u64,
dest: String,
max_outputs: usize,
selection_strategy: bool,
) -> Result<(), Error> {
checker::refresh_outputs(config, keychain)?;
@ -53,6 +54,7 @@ pub fn issue_send_tx(
current_height,
minimum_confirmations,
lock_height,
max_outputs,
selection_strategy,
)?;
@ -81,6 +83,7 @@ fn build_send_tx(
current_height: u64,
minimum_confirmations: u64,
lock_height: u64,
max_outputs: usize,
default_strategy: bool,
) -> Result<(Transaction, BlindingFactor), Error> {
let key_id = keychain.clone().root_key_id();
@ -92,6 +95,7 @@ fn build_send_tx(
amount,
current_height,
minimum_confirmations,
max_outputs,
default_strategy,
)
})?;
@ -121,6 +125,7 @@ pub fn issue_burn_tx(
keychain: &Keychain,
amount: u64,
minimum_confirmations: u64,
max_outputs: usize,
) -> Result<(), Error> {
let keychain = &Keychain::burn_enabled(keychain, &Identifier::zero());
@ -133,7 +138,14 @@ pub fn issue_burn_tx(
// select some spendable coins from the wallet
let coins = WalletData::read_wallet(&config.data_file_dir, |wallet_data| {
wallet_data.select(key_id.clone(), amount, current_height, minimum_confirmations, false)
wallet_data.select(
key_id.clone(),
amount,
current_height,
minimum_confirmations,
max_outputs,
false,
)
})?;
debug!(LOGGER, "selected some coins - {}", coins.len());

View file

@ -512,9 +512,9 @@ impl WalletData {
amount: u64,
current_height: u64,
minimum_confirmations: u64,
max_outputs: usize,
default_strategy: bool,
) -> Vec<OutputData> {
let max_outputs = 500;
// first find all eligible outputs based on number of confirmations
let mut eligible = self.outputs