aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet_rpc_server.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/wallet/wallet_rpc_server.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/wallet/wallet_rpc_server.cpp')
-rw-r--r--src/wallet/wallet_rpc_server.cpp27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/wallet/wallet_rpc_server.cpp b/src/wallet/wallet_rpc_server.cpp
index 5c42e1c53..dbfb880a1 100644
--- a/src/wallet/wallet_rpc_server.cpp
+++ b/src/wallet/wallet_rpc_server.cpp
@@ -918,8 +918,8 @@ namespace tools
std::list<std::pair<crypto::hash, tools::wallet2::confirmed_transfer_details>> payments;
m_wallet.get_payments_out(payments, min_height, max_height);
for (std::list<std::pair<crypto::hash, tools::wallet2::confirmed_transfer_details>>::const_iterator i = payments.begin(); i != payments.end(); ++i) {
- res.in.push_back(wallet_rpc::COMMAND_RPC_GET_TRANSFERS::entry());
- wallet_rpc::COMMAND_RPC_GET_TRANSFERS::entry &entry = res.in.back();
+ res.out.push_back(wallet_rpc::COMMAND_RPC_GET_TRANSFERS::entry());
+ wallet_rpc::COMMAND_RPC_GET_TRANSFERS::entry &entry = res.out.back();
const tools::wallet2::confirmed_transfer_details &pd = i->second;
entry.txid = string_tools::pod_to_hex(i->first);
@@ -969,6 +969,29 @@ namespace tools
}
}
+ if (req.pool)
+ {
+ 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) {
+ res.pool.push_back(wallet_rpc::COMMAND_RPC_GET_TRANSFERS::entry());
+ wallet_rpc::COMMAND_RPC_GET_TRANSFERS::entry &entry = res.pool.back();
+ const tools::wallet2::payment_details &pd = i->second;
+
+ entry.txid = string_tools::pod_to_hex(pd.m_tx_hash);
+ entry.payment_id = string_tools::pod_to_hex(i->first);
+ if (entry.payment_id.substr(16).find_first_not_of('0') == std::string::npos)
+ entry.payment_id = entry.payment_id.substr(0,16);
+ entry.height = 0;
+ entry.timestamp = pd.m_timestamp;
+ entry.amount = pd.m_amount;
+ entry.fee = 0; // TODO
+ entry.note = m_wallet.get_tx_note(pd.m_tx_hash);
+ }
+ }
+
return true;
}
//------------------------------------------------------------------------------------------------------------------------------