Skip to content

Commit

Permalink
Bubble init_send_tx error instead of unwrapping
Browse files Browse the repository at this point in the history
Fixes #582
  • Loading branch information
trevyn committed Apr 5, 2021
1 parent e9e6788 commit 6caa80c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions controller/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use crate::api::TLSConfig;
use crate::apiwallet::{try_slatepack_sync_workflow, Owner};
use crate::config::{TorConfig, WalletConfig, WALLET_CONFIG_FILE_NAME};
use crate::core::core::FeeFields;
use crate::core::{core, global};
use crate::error::{Error, ErrorKind};
use crate::impls::PathToSlatepack;
Expand Down Expand Up @@ -278,7 +277,7 @@ where
let mut slate = Slate::blank(2, false);
controller::owner_single_use(None, keychain_mask, Some(owner_api), |api, m| {
if args.estimate_selection_strategies {
let strategies: Vec<(&str, u64, FeeFields)> = vec!["smallest", "all"]
let strategies = vec!["smallest", "all"]
.into_iter()
.map(|strategy| {
let init_args = InitTxArgs {
Expand All @@ -291,10 +290,10 @@ where
estimate_only: Some(true),
..Default::default()
};
let slate = api.init_send_tx(m, init_args).unwrap();
(strategy, slate.amount, slate.fee_fields)
let slate = api.init_send_tx(m, init_args)?;
Ok((strategy, slate.amount, slate.fee_fields))
})
.collect();
.collect::<Result<Vec<_>, grin_wallet_libwallet::Error>>()?;
display::estimate(args.amount, strategies, dark_scheme);
return Ok(());
} else {
Expand Down

0 comments on commit 6caa80c

Please sign in to comment.