diff options
author | Riccardo Spagni <ric@spagni.net> | 2016-07-23 09:19:39 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2016-07-23 09:19:39 +0200 |
commit | 07f974a499150f209f41764a4bd715e2cb964fc1 (patch) | |
tree | 51852de3cb0744f922cc115ee36f5a0e6bd98013 /src/simplewallet/simplewallet.cpp | |
parent | Merge pull request #915 (diff) | |
parent | wallet: add unconfirmed incoming txes from the txpool (diff) | |
download | monero-07f974a499150f209f41764a4bd715e2cb964fc1.tar.xz |
Merge pull request #916
b89b963 wallet: add unconfirmed incoming txes from the txpool (moneromooo-monero)
Diffstat (limited to 'src/simplewallet/simplewallet.cpp')
-rw-r--r-- | src/simplewallet/simplewallet.cpp | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index d75f72464..9dd5f0c6e 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; |