Merge branch 'master' into master

This commit is contained in:
Gary Yu
2019-04-25 14:45:43 +08:00
committed by GitHub
17 changed files with 772 additions and 26 deletions
+24 -3
View File
@@ -24,9 +24,11 @@ use crate::grin_util;
use crate::grin_keychain::{Identifier, Keychain};
use crate::internal::{keys, selection, tx, updater};
use crate::slate::Slate;
use crate::types::{AcctPathMapping, NodeClient, TxLogEntry, TxWrapper, WalletBackend, WalletInfo};
use crate::types::{
AcctPathMapping, NodeClient, TxLogEntry, TxWrapper, WalletBackend, WalletInfo,
};
use crate::{Error, ErrorKind};
use crate::{InitTxArgs, NodeHeightResult, OutputCommitMapping};
use crate::{InitTxArgs, NodeHeightResult, OutputCommitMapping, PaymentCommitMapping};
const USER_MESSAGE_MAX_LEN: usize = 256;
@@ -81,10 +83,29 @@ where
Ok((
validated,
updater::retrieve_outputs(&mut *w, include_spent, tx_id, Some(&parent_key_id))?,
updater::retrieve_outputs(&mut *w, include_spent, tx_id, None, Some(&parent_key_id))?,
))
}
/// Returns a list of payment outputs from the active account in the wallet.
pub fn retrieve_payments<T: ?Sized, C, K>(
w: &mut T,
refresh_from_node: bool,
tx_id: Option<Uuid>,
) -> Result<(bool, Vec<PaymentCommitMapping>), Error>
where
T: WalletBackend<C, K>,
C: NodeClient,
K: Keychain,
{
let mut validated = false;
if refresh_from_node {
validated = update_outputs(w, false);
}
Ok((validated, updater::retrieve_payments(w, tx_id)?))
}
/// Retrieve txs
pub fn retrieve_txs<T: ?Sized, C, K>(
w: &mut T,