mirror of
https://github.com/jwinterm/grin-wallet.git
synced 2026-10-21 17:18:33 +02:00
@@ -247,7 +247,7 @@ pub fn send(
|
||||
let strategies = vec!["smallest", "all"]
|
||||
.into_iter()
|
||||
.map(|strategy| {
|
||||
let (total, fee) = api
|
||||
let est = api
|
||||
.estimate_initiate_tx(
|
||||
None,
|
||||
args.amount,
|
||||
@@ -257,7 +257,7 @@ pub fn send(
|
||||
strategy == "all",
|
||||
)
|
||||
.unwrap();
|
||||
(strategy, total, fee)
|
||||
(strategy, est.total, est.fee)
|
||||
})
|
||||
.collect();
|
||||
display::estimate(args.amount, strategies, dark_scheme);
|
||||
@@ -307,7 +307,7 @@ pub fn send(
|
||||
error!("Error validating participant messages: {}", e);
|
||||
return Err(e);
|
||||
}
|
||||
api.finalize_tx(&mut slate)?;
|
||||
slate = api.finalize_tx(&slate)?;
|
||||
} else {
|
||||
adapter.send_tx_async(&args.dest, &slate)?;
|
||||
api.tx_lock_outputs(&slate)?;
|
||||
@@ -378,7 +378,7 @@ pub fn finalize(
|
||||
error!("Error validating participant messages: {}", e);
|
||||
return Err(e);
|
||||
}
|
||||
let _ = api.finalize_tx(&mut slate).expect("Finalize failed");
|
||||
slate = api.finalize_tx(&mut slate).expect("Finalize failed");
|
||||
|
||||
let result = api.post_tx(&slate.tx, args.fluff);
|
||||
match result {
|
||||
|
||||
@@ -23,10 +23,9 @@ use crate::impls::{FileWalletCommAdapter, HTTPWalletCommAdapter, KeybaseWalletCo
|
||||
use crate::keychain::Keychain;
|
||||
use crate::libwallet::slate::Slate;
|
||||
use crate::libwallet::types::{
|
||||
CbData, NodeClient, OutputData, SendTXArgs, TxLogEntry, WalletBackend, WalletInfo,
|
||||
CbData, NodeClient, OutputCommitMapping, SendTXArgs, TxLogEntry, WalletBackend, WalletInfo,
|
||||
};
|
||||
use crate::libwallet::{Error, ErrorKind};
|
||||
use crate::util::secp::pedersen;
|
||||
use crate::util::to_base64;
|
||||
use crate::util::Mutex;
|
||||
use failure::ResultExt;
|
||||
@@ -187,7 +186,7 @@ where
|
||||
&self,
|
||||
req: &Request<Body>,
|
||||
api: Owner<T, C, K>,
|
||||
) -> Result<(bool, Vec<(OutputData, pedersen::Commitment)>), Error> {
|
||||
) -> Result<(bool, Vec<OutputCommitMapping>), Error> {
|
||||
let mut update_from_node = false;
|
||||
let mut id = None;
|
||||
let mut show_spent = false;
|
||||
@@ -373,7 +372,7 @@ where
|
||||
}
|
||||
api.tx_lock_outputs(&slate)?;
|
||||
if args.method != "file" {
|
||||
api.finalize_tx(&mut slate)?;
|
||||
slate = api.finalize_tx(&slate)?;
|
||||
}
|
||||
Ok(slate)
|
||||
}))
|
||||
@@ -385,8 +384,8 @@ where
|
||||
api: Owner<T, C, K>,
|
||||
) -> Box<dyn Future<Item = Slate, Error = Error> + Send> {
|
||||
Box::new(
|
||||
parse_body(req).and_then(move |mut slate| match api.finalize_tx(&mut slate) {
|
||||
Ok(_) => ok(slate.clone()),
|
||||
parse_body(req).and_then(move |slate| match api.finalize_tx(&slate) {
|
||||
Ok(s) => ok(s.clone()),
|
||||
Err(e) => {
|
||||
error!("finalize_tx: failed with error: {}", e);
|
||||
err(e)
|
||||
|
||||
+16
-15
@@ -14,10 +14,11 @@
|
||||
|
||||
use crate::core::core::{self, amount_to_hr_string};
|
||||
use crate::core::global;
|
||||
use crate::libwallet::types::{AcctPathMapping, OutputData, OutputStatus, TxLogEntry, WalletInfo};
|
||||
use crate::libwallet::types::{
|
||||
AcctPathMapping, OutputCommitMapping, OutputStatus, TxLogEntry, WalletInfo,
|
||||
};
|
||||
use crate::libwallet::Error;
|
||||
use crate::util;
|
||||
use crate::util::secp::pedersen;
|
||||
use prettytable;
|
||||
use std::io::prelude::Write;
|
||||
use term;
|
||||
@@ -27,7 +28,7 @@ pub fn outputs(
|
||||
account: &str,
|
||||
cur_height: u64,
|
||||
validated: bool,
|
||||
outputs: Vec<(OutputData, pedersen::Commitment)>,
|
||||
outputs: Vec<OutputCommitMapping>,
|
||||
dark_background_color_scheme: bool,
|
||||
) -> Result<(), Error> {
|
||||
let title = format!(
|
||||
@@ -54,25 +55,25 @@ pub fn outputs(
|
||||
bMG->"Tx"
|
||||
]);
|
||||
|
||||
for (out, commit) in outputs {
|
||||
let commit = format!("{}", util::to_hex(commit.as_ref().to_vec()));
|
||||
let index = match out.mmr_index {
|
||||
for m in outputs {
|
||||
let commit = format!("{}", util::to_hex(m.commit.as_ref().to_vec()));
|
||||
let index = match m.output.mmr_index {
|
||||
None => "None".to_owned(),
|
||||
Some(t) => t.to_string(),
|
||||
};
|
||||
let height = format!("{}", out.height);
|
||||
let lock_height = format!("{}", out.lock_height);
|
||||
let is_coinbase = format!("{}", out.is_coinbase);
|
||||
let height = format!("{}", m.output.height);
|
||||
let lock_height = format!("{}", m.output.lock_height);
|
||||
let is_coinbase = format!("{}", m.output.is_coinbase);
|
||||
|
||||
// Mark unconfirmed coinbase outputs as "Mining" instead of "Unconfirmed"
|
||||
let status = match out.status {
|
||||
OutputStatus::Unconfirmed if out.is_coinbase => "Mining".to_string(),
|
||||
_ => format!("{}", out.status),
|
||||
let status = match m.output.status {
|
||||
OutputStatus::Unconfirmed if m.output.is_coinbase => "Mining".to_string(),
|
||||
_ => format!("{}", m.output.status),
|
||||
};
|
||||
|
||||
let num_confirmations = format!("{}", out.num_confirmations(cur_height));
|
||||
let value = format!("{}", core::amount_to_hr_string(out.value, false));
|
||||
let tx = match out.tx_log_entry {
|
||||
let num_confirmations = format!("{}", m.output.num_confirmations(cur_height));
|
||||
let value = format!("{}", core::amount_to_hr_string(m.output.value, false));
|
||||
let tx = match m.output.tx_log_entry {
|
||||
None => "".to_owned(),
|
||||
Some(t) => t.to_string(),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user