aboutsummaryrefslogtreecommitdiff
path: root/src/simplewallet/simplewallet.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-05-23 21:40:12 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-07-20 19:14:44 +0100
commitb89b96394a33c96fb8135fc771f47bd1f65e0a06 (patch)
tree1ae520388bde88d8bfb8ca6d7d68a6baaada5dd2 /src/simplewallet/simplewallet.cpp
parentMerge pull request #911 (diff)
downloadmonero-b89b96394a33c96fb8135fc771f47bd1f65e0a06.tar.xz
wallet: add unconfirmed incoming txes from the txpool
Shown in show_transfers simplewallet command, and get_transfers RPC command, if req.pool is true.
Diffstat (limited to 'src/simplewallet/simplewallet.cpp')
-rw-r--r--src/simplewallet/simplewallet.cpp30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index 2bcd8ae4c..75344bf21 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -3082,6 +3082,7 @@ bool simple_wallet::show_transfers(const std::vector<std::string> &args_)
bool out = true;
bool pending = true;
bool failed = true;
+ bool pool = true;
uint64_t min_height = 0;
uint64_t max_height = (uint64_t)-1;
@@ -3099,7 +3100,7 @@ bool simple_wallet::show_transfers(const std::vector<std::string> &args_)
local_args.erase(local_args.begin());
}
else if (local_args[0] == "out" || local_args[0] == "outgoing") {
- in = false;
+ in = pool = false;
local_args.erase(local_args.begin());
}
else if (local_args[0] == "pending") {
@@ -3107,7 +3108,11 @@ bool simple_wallet::show_transfers(const std::vector<std::string> &args_)
local_args.erase(local_args.begin());
}
else if (local_args[0] == "failed") {
- in = out = pending = false;
+ in = out = pending = pool = false;
+ local_args.erase(local_args.begin());
+ }
+ else if (local_args[0] == "pool") {
+ in = out = pending = failed = false;
local_args.erase(local_args.begin());
}
else if (local_args[0] == "all" || local_args[0] == "both") {
@@ -3182,6 +3187,27 @@ bool simple_wallet::show_transfers(const std::vector<std::string> &args_)
((unsigned long long)i->first) % (i->second.first ? tr("in") : tr("out")) % i->second.second;
}
+ if (pool) {
+ try
+ {
+ m_wallet->update_pool_state();
+ std::list<std::pair<crypto::hash, tools::wallet2::payment_details>> payments;
+ m_wallet->get_unconfirmed_payments(payments);
+ for (std::list<std::pair<crypto::hash, tools::wallet2::payment_details>>::const_iterator i = payments.begin(); i != payments.end(); ++i) {
+ const tools::wallet2::payment_details &pd = i->second;
+ std::string payment_id = string_tools::pod_to_hex(i->first);
+ if (payment_id.substr(16).find_first_not_of('0') == std::string::npos)
+ payment_id = payment_id.substr(0,16);
+ std::string note = m_wallet->get_tx_note(pd.m_tx_hash);
+ message_writer() << (boost::format("%8.8s %6.6s %16.16s %20.20s %s %s %s %s") % "pool" % "in" % get_human_readable_timestamp(pd.m_timestamp) % print_money(pd.m_amount) % string_tools::pod_to_hex(pd.m_tx_hash) % payment_id % "-" % note).str();
+ }
+ }
+ catch (...)
+ {
+ fail_msg_writer() << "Failed to get pool state";
+ }
+ }
+
// print unconfirmed last
if (pending || failed) {
std::list<std::pair<crypto::hash, tools::wallet2::unconfirmed_transfer_details>> upayments;