mirror of
https://github.com/monero-project/monero.git
synced 2026-07-28 14:47:15 -07:00
wallet: unrestrict get_transfers and get_transfer_by_txid
This commit is contained in:
@@ -473,7 +473,7 @@ namespace tools
|
||||
return false;
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
void wallet_rpc_server::fill_transfer_entry(tools::wallet_rpc::transfer_entry &entry, const crypto::hash &txid, const crypto::hash &payment_id, const tools::wallet2::payment_details &pd)
|
||||
void wallet_rpc_server::fill_transfer_entry(tools::wallet_rpc::transfer_entry &entry, const crypto::hash &txid, const crypto::hash &payment_id, const tools::wallet2::payment_details &pd) const
|
||||
{
|
||||
entry.txid = string_tools::pod_to_hex(pd.m_tx_hash);
|
||||
entry.payment_id = string_tools::pod_to_hex(payment_id);
|
||||
@@ -494,7 +494,7 @@ namespace tools
|
||||
set_confirmations(entry, m_wallet->get_blockchain_current_height(), m_wallet->get_last_block_reward(), pd.m_unlock_time);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
void wallet_rpc_server::fill_transfer_entry(tools::wallet_rpc::transfer_entry &entry, const crypto::hash &txid, const tools::wallet2::confirmed_transfer_details &pd)
|
||||
void wallet_rpc_server::fill_transfer_entry(tools::wallet_rpc::transfer_entry &entry, const crypto::hash &txid, const tools::wallet2::confirmed_transfer_details &pd) const
|
||||
{
|
||||
entry.txid = string_tools::pod_to_hex(txid);
|
||||
entry.payment_id = string_tools::pod_to_hex(pd.m_payment_id);
|
||||
@@ -524,7 +524,7 @@ namespace tools
|
||||
set_confirmations(entry, m_wallet->get_blockchain_current_height(), m_wallet->get_last_block_reward(), pd.m_unlock_time);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
void wallet_rpc_server::fill_transfer_entry(tools::wallet_rpc::transfer_entry &entry, const crypto::hash &txid, const tools::wallet2::unconfirmed_transfer_details &pd)
|
||||
void wallet_rpc_server::fill_transfer_entry(tools::wallet_rpc::transfer_entry &entry, const crypto::hash &txid, const tools::wallet2::unconfirmed_transfer_details &pd) const
|
||||
{
|
||||
bool is_failed = pd.m_state == tools::wallet2::unconfirmed_transfer_details::failed;
|
||||
entry.txid = string_tools::pod_to_hex(txid);
|
||||
@@ -554,7 +554,7 @@ namespace tools
|
||||
set_confirmations(entry, m_wallet->get_blockchain_current_height(), m_wallet->get_last_block_reward(), pd.m_tx.unlock_time);
|
||||
}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
void wallet_rpc_server::fill_transfer_entry(tools::wallet_rpc::transfer_entry &entry, const crypto::hash &payment_id, const tools::wallet2::pool_payment_details &ppd)
|
||||
void wallet_rpc_server::fill_transfer_entry(tools::wallet_rpc::transfer_entry &entry, const crypto::hash &payment_id, const tools::wallet2::pool_payment_details &ppd) const
|
||||
{
|
||||
const tools::wallet2::payment_details &pd = ppd.m_pd;
|
||||
entry.txid = string_tools::pod_to_hex(pd.m_tx_hash);
|
||||
@@ -2909,12 +2909,6 @@ namespace tools
|
||||
bool wallet_rpc_server::on_get_transfers(const wallet_rpc::COMMAND_RPC_GET_TRANSFERS::request& req, wallet_rpc::COMMAND_RPC_GET_TRANSFERS::response& res, epee::json_rpc::error& er, const connection_context *ctx)
|
||||
{
|
||||
if (!m_wallet) return not_open(er);
|
||||
if (m_restricted)
|
||||
{
|
||||
er.code = WALLET_RPC_ERROR_CODE_DENIED;
|
||||
er.message = "Command unavailable in restricted mode.";
|
||||
return false;
|
||||
}
|
||||
|
||||
uint64_t min_height = 0, max_height = CRYPTONOTE_MAX_BLOCK_NUMBER;
|
||||
if (req.filter_by_height)
|
||||
@@ -2967,10 +2961,13 @@ namespace tools
|
||||
|
||||
if (req.pool)
|
||||
{
|
||||
std::vector<std::tuple<cryptonote::transaction, crypto::hash, bool>> process_txs;
|
||||
m_wallet->update_pool_state(process_txs);
|
||||
if (!process_txs.empty())
|
||||
m_wallet->process_pool_state(process_txs);
|
||||
if (!m_restricted)
|
||||
{
|
||||
std::vector<std::tuple<cryptonote::transaction, crypto::hash, bool>> process_txs;
|
||||
m_wallet->update_pool_state(process_txs);
|
||||
if (!process_txs.empty())
|
||||
m_wallet->process_pool_state(process_txs);
|
||||
}
|
||||
|
||||
std::list<std::pair<crypto::hash, tools::wallet2::pool_payment_details>> payments;
|
||||
m_wallet->get_unconfirmed_payments(payments, account_index, subaddr_indices);
|
||||
@@ -2986,12 +2983,6 @@ namespace tools
|
||||
bool wallet_rpc_server::on_get_transfer_by_txid(const wallet_rpc::COMMAND_RPC_GET_TRANSFER_BY_TXID::request& req, wallet_rpc::COMMAND_RPC_GET_TRANSFER_BY_TXID::response& res, epee::json_rpc::error& er, const connection_context *ctx)
|
||||
{
|
||||
if (!m_wallet) return not_open(er);
|
||||
if (m_restricted)
|
||||
{
|
||||
er.code = WALLET_RPC_ERROR_CODE_DENIED;
|
||||
er.message = "Command unavailable in restricted mode.";
|
||||
return false;
|
||||
}
|
||||
|
||||
crypto::hash txid;
|
||||
cryptonote::blobdata txid_blob;
|
||||
@@ -3050,10 +3041,13 @@ namespace tools
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::tuple<cryptonote::transaction, crypto::hash, bool>> process_txs;
|
||||
m_wallet->update_pool_state(process_txs);
|
||||
if (!process_txs.empty())
|
||||
m_wallet->process_pool_state(process_txs);
|
||||
if (!m_restricted)
|
||||
{
|
||||
std::vector<std::tuple<cryptonote::transaction, crypto::hash, bool>> process_txs;
|
||||
m_wallet->update_pool_state(process_txs);
|
||||
if (!process_txs.empty())
|
||||
m_wallet->process_pool_state(process_txs);
|
||||
}
|
||||
|
||||
std::list<std::pair<crypto::hash, tools::wallet2::pool_payment_details>> pool_payments;
|
||||
m_wallet->get_unconfirmed_payments(pool_payments, req.account_index);
|
||||
|
||||
@@ -268,10 +268,10 @@ namespace tools
|
||||
bool on_query_key(const wallet_rpc::COMMAND_RPC_QUERY_KEY::request& req, wallet_rpc::COMMAND_RPC_QUERY_KEY::response& res, epee::json_rpc::error& er, const connection_context *ctx = NULL);
|
||||
|
||||
// helpers
|
||||
void fill_transfer_entry(tools::wallet_rpc::transfer_entry &entry, const crypto::hash &txid, const crypto::hash &payment_id, const tools::wallet2::payment_details &pd);
|
||||
void fill_transfer_entry(tools::wallet_rpc::transfer_entry &entry, const crypto::hash &txid, const tools::wallet2::confirmed_transfer_details &pd);
|
||||
void fill_transfer_entry(tools::wallet_rpc::transfer_entry &entry, const crypto::hash &txid, const tools::wallet2::unconfirmed_transfer_details &pd);
|
||||
void fill_transfer_entry(tools::wallet_rpc::transfer_entry &entry, const crypto::hash &payment_id, const tools::wallet2::pool_payment_details &pd);
|
||||
void fill_transfer_entry(tools::wallet_rpc::transfer_entry &entry, const crypto::hash &txid, const crypto::hash &payment_id, const tools::wallet2::payment_details &pd) const;
|
||||
void fill_transfer_entry(tools::wallet_rpc::transfer_entry &entry, const crypto::hash &txid, const tools::wallet2::confirmed_transfer_details &pd) const;
|
||||
void fill_transfer_entry(tools::wallet_rpc::transfer_entry &entry, const crypto::hash &txid, const tools::wallet2::unconfirmed_transfer_details &pd) const;
|
||||
void fill_transfer_entry(tools::wallet_rpc::transfer_entry &entry, const crypto::hash &payment_id, const tools::wallet2::pool_payment_details &pd) const;
|
||||
bool not_open(epee::json_rpc::error& er);
|
||||
void handle_rpc_exception(const std::exception_ptr& e, epee::json_rpc::error& er, int default_error_code);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user