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/wallet/wallet_rpc_server.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/wallet/wallet_rpc_server.cpp')
-rw-r--r-- | src/wallet/wallet_rpc_server.cpp | 27 |
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; } //------------------------------------------------------------------------------------------------------------------------------ |